kubectl get -A ValidatingWebhookConfiguration
2024-08-23Internal error occurred: failed calling webhook "validate.nginx.ingress.kubernetes.io": failed to call webhook: Post "https://intranet-ingress-nginx-ack-ingress-nginx-v1-controller-admission.ingress-nginx.svc:443/networking/v1/ingresses?timeout=10s": service "intranet-ingress-nginx-ack-ingress-nginx-v1-controller-admission" not found
1、创建ingress报错Internal error occurred: failed calling webhook "validate.nginx.ingress.kubernetes.io": failed to call webhook 。。ingress-nginx-controller-admission
2、kubectl get -A ValidatingWebhookConfiguration
kubectl get -A ingress
kubectl delete -A ValidatingWebhookConfiguration ingress-nginx-admission
3、kubectl get svc,pod -A|grep nginx
kube-system service/ingress-nginx-controller-admission ClusterIP 192.168.4.210
kube-system service/nginx-ingress-lb LoadBalancer 192.168.79.154 1.1.1.1 80:31345/TCP,443:31084/TCP 28h
kubectl delete svc ingress-nginx-controller-admission -n kube-system
kubectl delete pod pod/nginx-ingress-controller -n kube-system
4、Admission webhook的作用是什么呢?
Admission webhook是K8S对请求资源对象的准入控制,Admission webhook有2中控制机制,MutatingAdmissionWebhook是对请求的对象的修改,sidecar就是通过此机制实现对请求对象进行修改,例如增加一个container或者配置。ValidatingAdmissionWebhook是对请求资源对象的合法性进行检查,避免错误的对象被写入导致发生异常,例如ingress写入了不合法配置,会导致ingress-controller的nginx reload一直失败,并且会阻塞后续所有的正确的ingress生效,本文也主要介绍ValidatingAdmissionWebhook,对于MutatingAdmissionWebhook原理和流程也是一样的。