更新时间:2024-07-02 GMT+08:00
NGINX Ingress控制器插件处于Unknown状态时卸载残留
问题现象
NGINX Ingress控制器插件处于Unknown状态时,卸载插件会出现组件残留。
NGINX Ingress控制器插件涉及的K8s资源:
- 命名空间级别资源:secret、configmap、deployment、service、role、rolebinding、lease、serviceAccount、job
- 集群级别资源:clusterRole、clusterRoleBinding、ingressClass、validatingWebhookConfiguration
解决方案
- 使用kubectl连接集群。
- 查找NGINX Ingress相关资源。
className="nginx" namespace="kube-system" className=`if [[ ${className} == "nginx" ]]; then echo ""; else echo "-${className}";fi` kubectl get -n ${namespace} secret sh.helm.release.v1.cceaddon-nginx-ingress${className}.v1 cceaddon-nginx-ingress${className}-admission kubectl get -n ${namespace} cm cceaddon-nginx-ingress${className}-controller kubectl get -n ${namespace} deploy cceaddon-nginx-ingress${className}-controller cceaddon-nginx-ingress${className}-default-backend kubectl get -n ${namespace} svc cceaddon-nginx-ingress${className}-controller-admission cceaddon-nginx-ingress${className}-default-backend cceaddon-nginx-ingress${className}-controller kubectl get -n ${namespace} role cceaddon-nginx-ingress${className} kubectl get -n ${namespace} rolebinding cceaddon-nginx-ingress${className} kubectl get -n ${namespace} lease ingress-controller-leader${className} kubectl get -n ${namespace} serviceAccount cceaddon-nginx-ingress${className} kubectl get clusterRole cceaddon-nginx-ingress${className} kubectl get clusterRoleBinding cceaddon-nginx-ingress${className} kubectl get ingressClass ${className} kubectl get ValidatingWebhookConfiguration cceaddon-nginx-ingress${className}-admission
其中className为控制器名称,namespace为安装NGINX Ingress控制器的命名空间。
- 如果集群中存在上述资源,请手动删除残留资源。