Remediation Steps:

ARTIFACTORY: How to resolve the 'rendered manifests contain a resource that already exists' error while running a helm upgrade

AuthorFullName__c
Yuvarajan Johnpaul
articleNumber
000006103
ft:sourceType
Salesforce
FirstPublishedDate
2024-05-23T10:41:02Z
lastModifiedDate
2024-05-23
VersionNumber
1
Let’s say, you’re observing an issue while installing Ingress, where the error message clearly indicates that an object with the string Ingress already exists.
(base) ➜  ~ helm upgrade --install nginx-ingress --namespace nginx-ingress-namespace ingress-nginx/ingress-nginx

Release "nginx-ingress" does not exist. Installing it now.

Error: rendered manifests contain a resource that already exists. Unable to continue with install: IngressClass "nginx" in namespace "" exists and cannot be imported into the current release: invalid ownership metadata; annotation validation error: key "meta.helm.sh/release-name" must equal "nginx-ingress": current value is "ingress-nginx"; annotation validation error: key "meta.helm.sh/release-namespace" must equal "nginx-ingress-namespace": current value is "ingress-nginx-ns"

In such a case, review the cluster role and the respective binding associated with it.
Step-1:

(base) ➜  ~ kubectl get clusterrole | grep ingress
ingress-nginx     2023-06-22T04:22:49Z

Step-2:

(base) ➜  ~ kubectl get clusterrolebinding | grep ingress
ingress-nginx      ClusterRole/ingress-nginx 

Note: Review the date of creation returned in the output to ensure that we are deleting the conflicting ones and then proceed with the deletion using the following commands.
(base) ➜  ~ kubectl delete clusterrole ingress-nginx
clusterrole.rbac.authorization.k8s.io "ingress-nginx" deleted

(base) ➜  ~ kubectl delete clusterrolebinding ingress-nginx
clusterrolebinding.rbac.authorization.k8s.io "ingress-nginx" deleted


After the successful deletion, the helm upgrade would go through without any issues.