背景: 版本: istio-1.11.0,使用 istio operator 进行安装,全程根据官方文档进行 link
部署 istio operator
istio operator init
创建 IstioOperator
$: kubectl apply -f - <<EOF
apiVersion: install.istio.io/v1alpha1
kind: IstioOperator
metadata:
namespace: istio-system
name: example-istiocontrolplane
spec:
profile: demo
EOF
这时查看 pod 的状态都是正常的,但是查看 iop 的状态却是错误的,而且这时无法创建 istio 的任何资源,比如:dr、vs 等等
[root networking]# kubectl get pod -n istio-system
NAME READY STATUS RESTARTS AGE
istio-egressgateway-f55b8c8fd-dwgtz 1/1 Running 0 17m
istio-ingressgateway-75cd9dc88b-wngvr 1/1 Running 0 17m
istiod-d746f686f-hxf6p 1/1 Running 0 17m
[root networking]# kubectl get iop -A
NAMESPACE NAME REVISION STATUS AGE
istio-system example-istiocontrolplane ERROR 9m11
直接查看 istio operator 或者 example-istiocontrolplane 都可以看出原因都是因为一下原因,从图中可以看出很多配置因为找不到 istiod 而创建失败。
failed to update resource with server-side apply for obj EnvoyFilter/istio-system/tcp-stats-filter-1.11: Internal error occurred: failed calling webhook "validation.istio.io": Post https://istiod.istio-system.svc:443/validate?timeout=30s: service "istiod" not found
着手修复,两个办法
- 一个是绕过 istiod 验证,
- 另一个就是一点点 debug 确认问题并修复了
因为急需使用我这里使用了 1,但是我个人不推荐使用 1,绕过 istiod 验证会导致所有配置的下发都不会验证,比如说你的 yaml 不符合规范这类最简单的问题都不会验证,如果大家有时间尽量不要使用方法 1
直接删除验证配置即可,删除前保存一份副本以防万一…
kubectl get validatingwebhookconfiguration istiod-istio-system -o yaml > temp.yaml
kubectl delete validatingwebhookconfiguration istiod-istio-system
然后等待 istio-operator 去同步 iop,如果等不及直接删除 istio-operator,再次重启就会将 iop 的状态同步为健康的。
[root networking]# kubectl get iop -A
NAMESPACE NAME REVISION STATUS AGE
istio-system example-istiocontrolplane HEALTHY 27m
这是方式不推荐,有时间的话我会 debug 看一下如何修复,更新博客。