istio 升級到1.3.0版本

準備

# 工做目錄/mnt/e/work/
# 下載安裝包
cd /mnt/e/work/
curl -L https://git.io/getLatestIstio | ISTIO_VERSION=1.3.0 sh -
配置環境變量刪除舊的
/etc/profile
export PATH="$PATH:/mnt/e/work/istio-1.3.0/bin"
source /etc/profile

升級

# 修改yaml 與上次版本參數一致
#使用Beyond Compare 4 差別對比
#修改gateways values.yaml 文件 刪除nodePort 固然也可不用刪除
#參數gateways.istio-ingressgateway.type=NodePort 
# 參數gateways.istio-ingressgateway.type=ClusterIP 必須刪除nodePort

istio 升級到1.3.0版本

# 修改 gateways\templates\service.yaml 文件
#添加 clusterIP: None # 方便暴露其它tcp 端口

istio 升級到1.3.0版本

#修改 istio-cni 
# 修改文件helm\istio-cni\templates\istio-cni.yaml
#添加內容 也能夠不用修改在這邊項目作了修改的
        - effect: NoSchedule
          key: node-role.kubernetes.io/ingress
          operator: Equal

istio 升級到1.3.0版本

升級istio

#檢查是否安裝 istio-cni  插件
helm status istio-cni --namespace istio-system
root@Qist:/mnt/f# helm status istio-cni --namespace istio-system
NAME: istio-cni
LAST DEPLOYED: 2019-09-18 16:33:57.4490493 +0800 DST
NAMESPACE: istio-system
STATUS: deployed
#返回正常證實已經安裝了istio-cni
#因爲istio-cni 安裝在非kube-system命名空間 先卸載istio-cni
helm uninstall istio-cni --namespace istio-system
# 等待卸載完成
helm install install/kubernetes/helm/istio-cni --name-template istio-cni --namespace istio-system \
--set cniBinDir=/apps/cni/bin   \ # cni 在宿主機目錄
--set excludeNamespaces={"istio-system,monitoring,kubernetes-dashboard,kube-system"}# 排除的命名空間
# 若是部署在kube-system 命名空間直接升級
helm upgrade --install istio-cni install/kubernetes/helm/istio-cni  --namespace kube-system \
--set cniBinDir=/apps/cni/bin   \
--set excludeNamespaces={"istio-system,monitoring,kubernetes-dashboard,kube-system"}
# 升級istio-init
helm upgrade --install istio-init install/kubernetes/helm/istio-init  --namespace istio-system --force
# 等待升級完成
# 使用如下命令驗證是否已將全部Istio CRD提交到Kubernetes api-server
kubectl get crds | grep 'istio.io' | wc -l
root@Qist:/mnt/f# kubectl get crds | grep 'istio.io' | wc -l
23
# 返回正常
# 升級istio圖表
# xxxx 替換成本身的域名
#xxxx.local 替換成本身k8s集羣域
helm upgrade --install istio install/kubernetes/helm/istio --namespace istio-system  \
--set gateways.istio-ingressgateway.type=ClusterIP   \ # ClusterIP IP 對外暴露服務 可設置NodePort
--set gateways.istio-egressgateway.enabled=true \ # 開啓istio-egressgateway 服務
--set gateways.istio-ingressgateway.serviceAnnotations={'kubernetes.io/ingress.class: traefik,traefik.ingress.kubernetes.io/affinity: true,traefik.ingress.kubernetes.io/load-balancer-method: drr'}  \ # 設置 istio-ingressgateway service 負載均衡規則及session  保持與使用traefik 對外提供ingress 服務 若是是其它ingress 必定要作修改
--set mixer.policy.enabled=true \ # 啓用策略檢查
--set grafana.enabled=true \ # 開啓grafana
--set grafana.ingress.enabled=true \ # 開啓grafana ingress
--set grafana.ingress.hosts={"gr.xxxx.com"} \ # 配置grafana  訪問域名
--set grafana.ingress.annotations={"kubernetes.io/ingress.class: traefik"} \ # 配置grafana 使用traefik 做爲轉發服務
--set grafana.contextPath=/ \ # 配置域名訪問路徑 默認路徑/grafana 
--set prometheus.ingress.enabled=true \ # 開啓prometheus ingress
--set prometheus.ingress.hosts={"pr.xxxx.com"} \  # 配置 prometheus 訪問域名
--set prometheus.ingress.annotations={"kubernetes.io/ingress.class: traefik"} \ #用traefik 做爲轉發服務
--set prometheus.contextPath=/ \ #配置域名訪問路徑 默認路徑/prometheus 
--set tracing.enabled=true \ # 開啓tracing 服務若是之前配置zipkin 做爲追蹤這裏請添加 tracing.provider=zipkin 不然部署會報錯
--set tracing.ingress.enabled=true \ # 開啓tracing ingress 
--set tracing.ingress.hosts={"tracing.xxxx.com"} \ # 配置tracing 域名訪問
--set tracing.ingress.annotations={"kubernetes.io/ingress.class: traefik"} \ # 用traefik 做爲轉發服務
--set tracing.contextPath=/ \ # 配置域名訪問路徑 默認路徑/tracing 
--set kiali.enabled=true \ # 開啓kiali 
--set kiali.ingress.enabled=true \ # 開啓kiali ingress 
--set kiali.ingress.hosts={"kiali.xxxx.com"} \ # 配置kiali 域名訪問服務
--set kiali.ingress.annotations={"kubernetes.io/ingress.class: traefik"} \ # 用traefik 做爲轉發服務
--set kiali.contextPath=/ \ #  配置域名訪問路徑 默認路徑/kiali 
--set kiali.dashboard.viewOnlyMode=true \ # 配置帳號只有讀取權限
--set kiali.dashboard.grafanaURL=http://gr.xxxx.com \ # 配置grafana 對外訪問路徑能夠是對外的IP 跟域名必定要外網訪問
--set kiali.dashboard.jaegerURL=http://tracing.xxxx.com \ # 配置jaeger 對外訪問路徑能夠是對外的IP 跟域名 若是啓用zipkin 這個配置失效
--set kiali.createDemoSecret=true \ # 設置kiali Secret 帳號密碼 默認admin/admin 
--set istio_cni.enabled=true   \ # 開啓  istio_cni
--set istio-cni.cniBinDir=/apps/cni/bin   \ # 配置 宿主機cni 路徑
--set istio-cni.excludeNamespaces={"istio-system,monitoring,kubernetes-dashboard,kube-system"}  \ # 排除命名空間
--set global.k8sIngress.enabled=true \ # 開啓用於K8S入口資源的網關
--set global.proxy.clusterDomain="xxxx.local" \ # k8s 集羣域istio-proxy 會用到
--set global.proxy.accessLogFile="/dev/stdout" \ # 代理日誌輸出到/dev/stdout 
--set global.proxy.logLevel="info" \ # 代理日誌輸出級別
--set global.disablePolicyChecks=false \  #開啓策略檢查
--set global.proxy.autoInject=disabled # 關閉istio-injection 爲enabled 自動注入 設置爲使用annotations 註釋進行注入 sidecar.istio.io/inject: "true" 默認 sidecar.istio.io/inject: "false"
# 等待升級完成 
kubectl get pod -n istio-system
root@Qist:/mnt/f# kubectl get pod -n istio-system
NAME                                      READY   STATUS      RESTARTS   AGE
grafana-7bfb599d6c-5828h                  1/1     Running     0          17h
istio-citadel-5f85674d5b-x2hbt            1/1     Running     0          17h
istio-cleanup-secrets-1.3.0-rxsqz         0/1     Completed   0          18h
istio-cni-node-4774c                      1/1     Running     0          17h
istio-cni-node-4t7rz                      1/1     Running     0          17h
istio-cni-node-h56gq                      1/1     Running     0          17h
istio-cni-node-nc64k                      1/1     Running     0          17h
istio-cni-node-rd2pw                      1/1     Running     0          17h
istio-cni-node-tzjjn                      1/1     Running     0          17h
istio-cni-node-xgrj7                      1/1     Running     0          17h
istio-egressgateway-55978569d6-cw99p      1/1     Running     0          17h
istio-galley-545fbd68c8-56pmq             1/1     Running     0          17h
istio-ingressgateway-898dd6645-g6jsc      1/1     Running     0          17h
istio-init-crd-10-1.3.0-shl5z             0/1     Completed   0          17h
istio-init-crd-11-1.3.0-rmqjl             0/1     Completed   0          17h
istio-init-crd-12-1.3.0-nckdw             0/1     Completed   0          17h
istio-pilot-7cf68bfd87-fdwx5              2/2     Running     0          17h
istio-policy-7cf59b54db-pq27s             2/2     Running     0          17h
istio-sidecar-injector-5796d5b447-qgnx4   1/1     Running     0          17h
istio-telemetry-8cbc98d59-v5pl4           2/2     Running     0          17h
istio-tracing-d4f8cdf58-2jbdg             1/1     Running     0          16h
kiali-c5965f96c-pdhg9                     1/1     Running     0          15h
prometheus-5b68448dc9-pl9qf               1/1     Running     0          17h
# 全部pod 狀態正常 
#邊車升級 
#在控制平面升級以後,已經運行Istio的應用程序仍將使用較舊的邊車。要升級邊車,您須要從新注入它。
#若是您正在使用自動邊車注入,您能夠經過對全部吊艙進行滾動更新來升級邊車,以便自動從新注入新版本的邊車。
kubectl rollout restart deployment nginx --namespace default
kubectl get pod -n default | grep nginx
root@Qist:/mnt/f# kubectl get pod -n default | grep nginx
nginx-v1-54dffc665c-gv29t   3/3     Running   0          15h
nginx-v1-54dffc665c-kxp89   3/3     Running   0          15h
nginx-v2-688f8f54d7-fw54c   3/3     Running   0          15h
nginx-v2-688f8f54d7-jbch2   3/3     Running   0          15h
# 查看 pod nginx-v2-688f8f54d7-jbch2 邊車是否最新
kubectl describe pod pod nginx-v2-688f8f54d7-jbch2| grep proxyv2
root@Qist:/mnt/f# kubectl describe pod pod nginx-v2-688f8f54d7-jbch2| grep proxyv2
Error from server (NotFound): pods "pod" not found
    Image:         docker.io/istio/proxyv2:1.3.0
    Image ID:      docker-pullable://istio/proxyv2@sha256:f3f68f9984dc2deb748426788ace84b777589a40025085956eb880c9c3c1c056
# 已是最新版本1.3.0 至此       istio 升級安裝完成

istio 完整安裝

# 須要修改的配置參考 升級
# istio-init 安裝
helm install install/kubernetes/helm/istio-init --name-template istio-init --namespace istio-system
kubectl get crds | grep 'istio.io' | wc -l
# istio 安裝
helm install install/kubernetes/helm/istio --name-template istio --namespace istio-system  \
--set gateways.istio-ingressgateway.type=ClusterIP   \
--set gateways.istio-egressgateway.enabled=true \
--set gateways.istio-ingressgateway.serviceAnnotations={'kubernetes.io/ingress.class: traefik,traefik.ingress.kubernetes.io/affinity: true,traefik.ingress.kubernetes.io/load-balancer-method: drr'}  \
--set mixer.policy.enabled=true \
--set grafana.enabled=true \
--set grafana.ingress.enabled=true \
--set grafana.ingress.hosts={"gr.xxxx.com"} \
--set grafana.ingress.annotations={"kubernetes.io/ingress.class: traefik"} \
--set grafana.contextPath=/ \
--set prometheus.ingress.enabled=true \
--set prometheus.ingress.hosts={"pr.xxxx.com"} \
--set prometheus.ingress.annotations={"kubernetes.io/ingress.class: traefik"} \
--set prometheus.contextPath=/ \
--set tracing.enabled=true \
--set tracing.ingress.enabled=true \
--set tracing.ingress.hosts={"tracing.xxxx.com"} \
--set tracing.ingress.annotations={"kubernetes.io/ingress.class: traefik"} \
--set tracing.contextPath=/ \
--set kiali.enabled=true \
--set kiali.ingress.enabled=true \
--set kiali.ingress.hosts={"kiali.xxxx.com"} \
--set kiali.ingress.annotations={"kubernetes.io/ingress.class: traefik"} \
--set kiali.contextPath=/ \
--set kiali.dashboard.viewOnlyMode=true \
--set kiali.dashboard.grafanaURL=http://gr.xxxx.com \
--set kiali.dashboard.jaegerURL=http://tracing.xxxx.com \
--set kiali.createDemoSecret=true \
--set istio_cni.enabled=true   \
--set istio-cni.cniBinDir=/apps/cni/bin   \
--set istio-cni.excludeNamespaces={"istio-system,monitoring,kubernetes-dashboard,kube-system"}  \
--set global.k8sIngress.enabled=true \
--set global.proxy.clusterDomain="xxxx.local" \
--set global.proxy.accessLogFile="/dev/stdout" \
--set global.proxy.logLevel="info" \
--set global.disablePolicyChecks=false \
--set global.proxy.autoInject=disabled
# istio-cni 安裝
helm install install/kubernetes/helm/istio-cni --name-template istio-cni --namespace istio-system \
--set cniBinDir=/apps/cni/bin   \
--set excludeNamespaces={"istio-system,monitoring,kubernetes-dashboard,kube-system"}

最新 展現截圖

kiali

istio 升級到1.3.0版本
istio 升級到1.3.0版本

jaeger

istio 升級到1.3.0版本

grafana

istio 升級到1.3.0版本
istio 升級到1.3.0版本
istio 升級到1.3.0版本

相關文章
相關標籤/搜索