Helm 3 install for resouces that exist

when running helm install (helm 3.0.2)

I got the following error: Error: rendered manifests contain a resource that already exists. Unable to continue with install: existing resource conflict: kind: PodSecurityPolicy, namespace: , name: po-kube-state-metrics

But I don't find it and also In the error im not getting the ns, How can I remove it ?

when running kubectl get all --all-namespaces I see all the resources but not the po-kub-state-metrics ... it also happen to other resources, any idea?

I got the same error to: monitoring-grafana entity and the result of kubectl get PodSecurityPolicy --all-namespaces is:

monitoring-grafana false RunAsAny RunAsAny RunAsAny RunAsAny false configMap,emptyDir,projected,secret,do

3

7 Answers

First of all you need to make sure you've successfully uninstalled the helm release, before reinstalling.

To list all the releases, use:

$ helm list --all --all-namespaces 

To uninstall a release, use:

$ helm uninstall <release-name> -n <namespace> 

You can also use --no-hooks to skip running hooks for the command:

$ helm uninstall <release-name> -n <namespace> --no-hooks 

If uninstalling doesn't solve your problem, you can try the following command to cleanup:

$ helm template <NAME> <CHART> --namespace <NAMESPACE> | kubectl delete -f - 

Sample:

$ helm template happy-panda stable/mariadb --namespace kube-system | kubectl delete -f - 

Now, try installing again.

Update:

Let's consider that your chart name is mon and your release name is po. Since you are in the charts directory (.) like below:

. ├── mon │   ├── Chart.yaml │   ├── README.md │   ├── templates │   │   ├── one.yaml │   │   ├── two.yaml │   │   ├── three.yaml │   │   ├── _helpers.tpl │   │   ├── NOTES.txt │   └── values.yaml 

Then you can skip the helm repo name (i.e. stable) in the helm template command. Helm will use your mon chart from the directory.

$ helm template po mon --namespace mon | kubectl delete -f - 
2

i've got the same issue while deploying Istio. So i did

kubectl get clusterrole kubectl get clusterrolebinging kubectl delete mutatingwebhookconfiguration istio-sidecar-injector kubectl delete validatingwebhookconfiguration istio-galley kubectl delete namespace <istio-namespace> 

and when deleted all and started, it worked.

I had the same error with CRDs objects. I used this chart on Github, and to prevent this error I used the --skip-crds flag. Maybe the project that you are using has something like this:

1

So nor the --force or no the other options help. Here is the error that I was getting.

Release "develop-myrelease" does not exist. Installing it now. Error: rendered manifests contain a resource that already exists. Unable to continue with install: existing resource conflict: namespace: , name: develop-myrelease, existing_kind: Kind=ClusterRoleBinding, new_kind: Kind=ClusterRoleBinding 

So I just delete clusterrolebinding and its work.

kubectl get clusterrolebinding | grep develop-myrelease kubectl delete clusterrolebinding develop-myrelease 

and run the deployment again.

for my case able to successfully upgrade my build with --force

Mulhasans-MacBook-Pro:helm-tuts mulhasan$ helm upgrade --install --force api-streamingserver ./api-streamingserver 

This will help for the same Release if you are doing with different release choose a different name for conflicting resources as of now Helmv3.x doesn't have option for CRDs --skip-crds is removed in Helmv3.x

0

If you are upgrading to helm 3, ensure you can run helm 2 and helm 3 separately. Example

helm2 list helm3 list 

After this, if you will try to install a helm chart within helm 3, that error will pops-up because it exists in helm 2.

Use helm2to3 plugin to upgrade to Helm3:

I follow this exactly and I got no issues

I spent many hours on bugs that are related to the error:

Error: rendered manifests contain a resource that already exists...

I have 3 simple conclusions:

1 ) Resources from previous deployments (via kubectl or helm) might exists in the cluster.

2 ) Use an advanced administrative/debugging tool like k9s or Lens to view ALL cluster resources (instead of kubectl get / helm ls).

3 ) Usally, the resource names which are specified in the error has a meaning - search directly for them and see if they can be deleted.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

You Might Also Like