38

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

JME
  • 881
  • 2
  • 11
  • 23

7 Answers7

69

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 -
Kamol Hasan
  • 12,218
  • 1
  • 37
  • 46
  • thanks a lot, this give me some direction. if I install the helm chart with the current dir `.` like this ` helm upgrade --install mon--namespace mon . -f values.yaml` , how should I delete it in this case ? – JME Dec 23 '19 at 09:13
  • I was getting a similar error. `helm lint` raised issues which i had to go fix. – Srinath Ganesh Dec 23 '20 at 13:51
7

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.

Risadinha
  • 16,058
  • 2
  • 88
  • 91
DheerajG
  • 97
  • 2
  • 7
5

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: https://github.com/helm/charts/tree/master/incubator/sparkoperator#configuration

Eduardo Baitello
  • 10,469
  • 7
  • 46
  • 74
Daniel Marques
  • 1,249
  • 8
  • 17
  • 1
    Thanks, this answer solved my problem. Have had the same issue with CRDs. If i wanted to install a chart with crds, which are already existed on my cluster, helm failes with the errormessage ```rendered manifests contain a resource that already exists. Unable to continue with install```. I already tried the ```--skip-crds```, but didnt took into account, that the corresponding helm templates containg the crd definitions have to be placed in a folder called ```crds```. Your link led me to the right direction :) – snukone Jan 12 '20 at 14:50
4

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: rbac.authorization.k8s.io/v1beta1, Kind=ClusterRoleBinding, new_kind: rbac.authorization.k8s.io/v1beta1, 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.

Adiii
  • 54,482
  • 7
  • 145
  • 148
2

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

Mansur Ul Hasan
  • 2,898
  • 27
  • 24
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: https://helm.sh/blog/migrate-from-helm-v2-to-helm-v3

I follow this exactly and I got no issues

Felix Labayen
  • 385
  • 3
  • 8
0

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.

Rot-man
  • 18,045
  • 12
  • 118
  • 124