kubernetes實踐之六十九:istio-1.0.0部署和試用
一:簡介
本文介紹如何在kubernetes1.10.4叢集中部署istio-1.0.0 並試用istio自帶的bookinfo例項應用。
二:安裝
1.獲取安裝包
wget https://github.com/istio/istio/releases/download/1.0.0/istio-1.0.0-linux.tar.gz
tar -zxvf istio-1.0.0-linux.tar.gz
2.安裝istioctl
如果手動注入sidecar的話需要使用這個命令:
cp istio- 1.0 . /bin/istioctl /usr/local/bin/
設定環境變數:
ISTIO_HOME=/root/istio-1.0
PATH=$ISTIO_HOME/bin:$PATH
export ISTIO_HOME PATH
3.安裝istio核心元件
kubectl apply -f istio-1.0.0/install/kubernetes/istio-demo.yaml
gcr.io和quay.io相關的映象下載不了的話可以替換為自己的映象:
daocloud.io/liukuan73/proxy_init:1.0.0
daocloud.io/liukuan73/galley:1.0.0
daocloud.io/liukuan73/mixer:1.0.0
daocloud.io/liukuan73/proxyv2:1.0.0
daocloud.io/liukuan73/pilot:1.0.0
daocloud.io/liukuan73/citadel:1.0.0
daocloud.io/liukuan73/servicegraph:1.0.0
daocloud.io/liukuan73/sidecar_injector:1.0.0
daocloud.io/liukuan73/istio-grafana:1.0.0
4.安裝結果驗證
三:試用
1.sidecar自動注入配置
Istio裝好後,如果想sidecar在應用啟動時自動注入到pod中,還需要配置如下4步:
a.安裝istio-sidecar-injector
安裝了istio-sidecar-injector後,kubectl create起應用的時候sidecar容器會直接自動注入到pod中,而不用手動注入。
b.啟用mutating webhook admission controller
在kube-apiserver的啟動引數的admission controller中按正確順序加入如下兩個controller:MutatingAdmissionWebhook,ValidatingAdmissionWebhook
--admission-control=ServiceAccount,Initializers,NamespaceLifecycle,NamespaceExists,LimitRanger,DefaultStorageClass,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,ResourceQuota
c.啟用admissionregistration api
kubectl api-versions | grep admissionregistration
admissionregistration.k8s.io/v1beta1
d.為需要自動注入sidecar的namespace打label
kubectl label namespace istio-test istio-injection=enabled
kubectl get namespace -L istio-injection
2.啟動示例應用
a.示例結構
b.安裝示例
kubectl apply -n istio-test -f istio-1.0.0/samples/bookinfo/platform/kube/bookinfo.yaml
c. 配置traefik Ingress
為了便於叢集外訪問驗證,配置Ingress代理
apiVersion: extensions/v1beta1 kind: Ingress metadata: name: traefik-ingress namespace: kube-system spec: rules: - host: elasticsearch.donkey http: paths: - path: / backend: serviceName: elasticsearch-logging servicePort: 9200 - host: kibana.donkey http: paths: - path: / backend: serviceName: kibana-logging servicePort: 5601 - host: locust.donkey http: paths: - path: / backend: serviceName: locust-master servicePort: 8089 - host: dashboard.donkey http: paths: - path: / backend: serviceName: kubernetes-dashboard servicePort: 32666 --- apiVersion: extensions/v1beta1 kind: Ingress metadata: name: istio-ingress namespace: istio-system spec: rules: - host: grafana.istio.donkey http: paths: apiVersion: extensions/v1beta1 kind: Ingress metadata: name: traefik-ingress namespace: kube-system spec: rules: - host: elasticsearch.donkey http: paths: - path: / backend: serviceName: elasticsearch-logging servicePort: 9200 - host: kibana.donkey http: paths: - path: / backend: serviceName: kibana-logging servicePort: 5601 - host: locust.donkey http: paths: - path: / backend: serviceName: locust-master servicePort: 8089 - host: dashboard.donkey http: paths: - path: / backend: serviceName: kubernetes-dashboard servicePort: 32666 --- apiVersion: extensions/v1beta1 kind: Ingress metadata: name: istio-ingress namespace: istio-system spec: rules: - host: grafana.istio.donkey http: paths: - path: / backend: serviceName: grafana servicePort: 3000 - host: zipkin.istio.donkey http:
3.示例驗證
a.bookinfo 示例 http://productpage.donkey/productpage?u=normal
b.監控 http://grafana.istio.donkey
c. Prometheus頁面 http://prometheus.istio.donkey
d. ServiceGraph頁面
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/28624388/viewspace-2199899/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- kubernetes實踐之十二:部署Traefik Ingress
- Kubernetes 部署 Laravel 應用的最佳實踐Laravel
- DevOps最佳實踐之應用開發和部署dev
- kubernetes實踐之六十八:部署 coredns 外掛DNS
- kubernetes1.13.X實踐-部署
- 容器化部署實踐之Django應用部署(二)Django
- kubernetes實踐之十一:EFK
- kubernetes實踐之六十:Cabin-Manage Kubernetes
- 使用Docker容器化部署實踐之Django應用部署(一)DockerDjango
- kubernetes實踐之五十七:PodPreset
- kubernetes實踐之五十八:CronJob
- kubernetes實踐之五十二:Helm
- kubernetes實踐之五十九:NetworkPolicy
- kubernetes實踐之十九:API概述API
- kubernetes實踐之十七:架構架構
- kubernetes實踐之八:TLS bootstrappingTLSbootAPP
- Kubernetes(k8s)部署安全最佳實踐K8S
- 利用 Kubeadm部署 Kubernetes 1.13.1 叢集實踐錄
- SpringCloud 應用在 Kubernetes 上的最佳實踐 — 部署篇(工具部署)SpringGCCloud
- Kubernetes容器化工具Kind實踐部署Kubernetes v1.18.x 版本, 釋出WordPress和MySQLMySql
- kubernetes實踐之十:Kubernetes-dashboard+Heapster+InfluxDB+GrafanaUXGrafana
- 利用 Kubernetes 降本增效?EasyMR 基於 Kubernetes 部署的探索實踐
- Kubernetes YAML最佳實踐和策略YAML
- kubernetes實踐之四十二:StatefulSet
- kubernetes實踐之六十四:CoreDNSDNS
- kubernetes實踐之五十六:雲原生
- kubernetes實踐之五:網路模型模型
- kubernetes實踐之九:kube-dnsDNS
- GitOps實踐之kubernetes安裝argocdGitGo
- kubernetes實踐之四十六:分散式負載測試Locust分散式負載
- kubernetes實踐之五十五:kubectl之配置kubeconfig
- SpringCloud 應用在 Kubernetes 上的最佳實踐 — 部署篇(開發部署)SpringGCCloud
- Pulsar部署和實踐(一)
- Kubernetes 入門實踐--部署執行 Go 專案Go
- Kubernetes監控實踐(2):可行監控方案之Prometheus和SensuPrometheus
- kubernetes實踐之十四:Service Account與Secret
- kubernetes實踐之四十七:ResourceQuota ControllerController
- kubernetes實踐之六十五:Service Mesh