istio安裝demo 中 bookinfo 遇到的問題

按照官網的步驟已經裝好了k8s集羣,一個主節點,兩個node節點

然後在網絡好的情況下安裝了istio 

[root@istio-master istio-1.6.8]# istioctl version
client version: 1.6.8
control plane version: 1.6.8
data plane version: 1.6.8 (3 proxies)

  

命名空間已經創建完畢

[root@istio-master istio-1.6.8]# kubectl get ns
NAME              STATUS   AGE
default           Active   46h
istio-system      Active   24h
kube-node-lease   Active   46h
kube-public       Active   46h
kube-system       Active   46h

 

istio的組件也已經安裝好

[root@istio-master istio-1.6.8]# kubectl get po -n istio-system
NAME                                    READY   STATUS    RESTARTS   AGE
grafana-b54bb57b9-g5l22                 1/1     Running   3          18h
istio-egressgateway-7447bd847b-25f9q    1/1     Running   3          18h
istio-ingressgateway-59c788fd4f-b584h   1/1     Running   3          18h
istio-tracing-9dd6c4f7c-l7qg5           1/1     Running   3          18h
istiod-54d84dc79c-46lnj                 1/1     Running   3          18h
kiali-d45468dc4-2nlbm                   1/1     Running   3          18h
prometheus-79fb649b4d-vxlvp             2/2     Running   6          18h

按照步驟下載demo

istioctl install --set profile=demo -y

對默認的default 命名空間允許自動注入

kubectl label namespace default istio-injection=enabled

安裝bookinfo應用

kubectl apply -f samples/bookinfo/platform/kube/bookinfo.yaml

查看istio-system下面的服務

[root@istio-master istio-1.6.8]# kubectl get services
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
details ClusterIP 10.98.20.95 <none> 9080/TCP 12h
kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 47h
productpage ClusterIP 10.101.178.151 <none> 9080/TCP 12h
ratings ClusterIP 10.111.150.158 <none> 9080/TCP 12h
reviews ClusterIP 10.103.216.244 <none> 9080/TCP 12h

 

也沒有問題

但是默認命名空間下沒有創建pod

[root@istio-master istio-1.6.8]# kubectl get po 
No resources found in default namespace.

肯定是自動注入sidecar失敗了,甚至連pod 都創建失敗了,探索原因

 

查看bookinfo 創建應用的pod報錯原因

[root@istio-master istio-1.6.8]# kubectl describe deployment productpage

 

已經找到對應的pod 

 

 

 

執行語句查看pod報錯原因

[root@istio-master istio-1.6.8]# kubectl describe replicaset productpage-v1-6987489c74

 

 

  Warning  FailedCreate  124m (x3 over 12h)   replicaset-controller  Error creating: Internal error occurred: failed calling webhook "sidecar-injector.istio.io": Post https://istiod.istio-system.svc:443/inject?timeout=30s: context deadline exceeded (Client.Timeout exceeded while awaiting headers)
  Warning  FailedCreate  107m (x15 over 12h)  replicaset-controller  Error creating: Internal error occurred: failed calling webhook "sidecar-injector.istio.io": Post https://istiod.istio-system.svc:443/inject?timeout=30s: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
  Warning  FailedCreate  72m (x9 over 12h)    replicaset-controller  Error creating: Internal error occurred: failed calling webhook "sidecar-injector.istio.io": Post https://istiod.istio-system.svc:443/inject?timeout=30s: context deadline exceeded
  Warning  FailedCreate  50m (x2 over 54m)    replicaset-controller  Error creating: Internal error occurred: failed calling webhook "sidecar-injector.istio.io": Post https://istiod.istio-system.svc:443/inject?timeout=30s: context deadline exceeded (Client.Timeout exceeded while awaiting headers)
  Warning  FailedCreate  33m (x10 over 53m)   replicaset-controller  Error creating: Internal error occurred: failed calling webhook "sidecar-injector.istio.io": Post https://istiod.istio-system.svc:443/inject?timeout=30s: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
  Warning  FailedCreate  5m1s (x8 over 53m)   replicaset-controller  Error creating: Internal error occurred: failed calling webhook "sidecar-injector.istio.io": Post https://istiod.istio-system.svc:443/inject?timeout=30s: context deadline exceeded

 

看報錯信息提示

failed calling webhook "sidecar-injector.istio.io"
這個組件連接失敗

幾乎找遍了istio官網沒找到答案, 也看到網絡上好幾個小夥伴出現了這個問題也沒有解決。

上官網,Istio / Sidecar Injection Problems沒有一個描述是符合的。github issue也沒有提到要安裝metrics-server

就去安裝metics-server

[root@istio-master istio-1.6.8]# kubectl top pods 
Error from server (NotFound): the server could not find the requested resource (get services http:heapster:)

上面信息證明沒有安裝metics-server

按照 下面兩個博客進行安裝,

https://www.cnblogs.com/lfl17718347843/p/14283796.html

https://blog.51cto.com/u_14783669/2521159

 

但是k8s.gcr.io/metrics-server/metrics-server  這個鏡像不可用,又重新在網上新找一個 v0.4.1 版本的鏡像 部署到node2節點 這才成功

 

再次走上面的邏輯進行sidecar進行自動注入

首先刪除之前的pod

samples/bookinfo/platform/kube/cleanup.sh

 

清理過後重新走

kubectl apply -f samples/bookinfo/platform/kube/bookinfo.yaml

  

結果完美解決自動注入問題

[root@istio-master istio-1.6.8]# kubectl get pods
NAME                              READY   STATUS    RESTARTS   AGE
details-v1-558b8b4b76-2dh4d       2/2     Running   0          2m41s
productpage-v1-6987489c74-9nnbc   2/2     Running   0          2m40s
ratings-v1-7dc98c7588-vrszj       2/2     Running   0          2m40s
reviews-v1-7f99cc4496-cd7w7       2/2     Running   0          2m40s
reviews-v2-7d79d5bd5d-xzl4k       2/2     Running   0          2m41s
reviews-v3-7dbcdcbc56-8ndvh       2/2     Running   0          2m41s

  

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章