k8s集群安装nginx-ingress报错解决
可能是因为之前集群内安装过nginx-ingress,没有删除彻底,再次安装nginx-ingress的时候就提示有资源存在。
报错如下:
Error: INSTALLATION FAILED: rendered manifests contain a resource that already exists. Unable to continue with install: ClusterRole "ingress-nginx" in namespace "" exists and cannot be imported into the current release: invalid ownership metadata; label validation error: missing key "app.kubernetes.io/managed-by": must be set to "Helm"; annotation validation error: missing key "meta.helm.sh/release-name": must be set to "ingress-nginx"; annotation validation error: missing key "meta.helm.sh/release-namespace": must be set to "ingress-nginx"
或者:
Error: INSTALLATION FAILED: rendered manifests contain a resource that already exists. Unable to continue with install: ClusterRoleBinding "ingress-nginx" in namespace "" exists and cannot be imported into the current release: invalid ownership metadata; label validation error: missing key "app.kubernetes.io/managed-by": must be set to "Helm"; annotation validation error: missing key "meta.helm.sh/release-name": must be set to "ingress-nginx"; annotation validation error: missing key "meta.helm.sh/release-namespace": must be set to "ingress-nginx"
或者:
Error: INSTALLATION FAILED: rendered manifests contain a resource that already exists. Unable to continue with install: ValidatingWebhookConfiguration "ingress-nginx-admission" in namespace "" exists and cannot be imported into the current release: invalid ownership metadata; label validation error: missing key "app.kubernetes.io/managed-by": must be set to "Helm"; annotation validation error: missing key "meta.helm.sh/release-name": must be set to "ingress-nginx"; annotation validation error: missing key "meta.helm.sh/release-namespace": must be set to "ingress-nginx"
简单来说就是已经有资源存在,注意上述报错中的红色字体,是关键点,需要删除掉,提示提示的就是什么类型资源里面有什么名称的资源已经存在,有了这些我们去找到并删除即可。
距离:使用如下命令查找所有命名空间里面的CluserterRoleBing,找到那个存在的,看再什么命名空间呢,使用kubectl delete 资源类型 名称 -n 命名空间 删掉即可。
kubectl get ClusterRoleBinding --all-namespaces
本文来自博客园,作者:忙碌在路上,转载请注明原文链接:https://www.cnblogs.com/netsa/p/17091474.html