Ambassador helm chart upgrade fails with resource already exists in the cluster and wasn't defined in the previous release error

1/6/2020

Updating ambassador helm chart with

helm upgrade --install --wait ambassador -f ambassador-helm-values.yaml stable/ambassador

fails with:

UPGRADE FAILED
Error: kind ClusterRoleBinding with the name "ambassador-crds" already exists in the cluster and wasn't defined in the previous release. Before upgrading, please either delete the resource from the cluster or remove it from the chart
Error: UPGRADE FAILED: kind ClusterRoleBinding with the name "ambassador-crds" already exists in the cluster and wasn't defined in the previous release. Before upgrading, please either delete the resource from the cluster or remove it from the chart

Deleted ClusterRoleBinding ambassador-crds and tried to run helm upgrade command. Which generates the ambassador-crds again and fails with same error message.

-- Parth Modi
ambassador
cert-manager
kubernetes-helm

2 Answers

1/12/2020

Did you try to install the specific resource via kubectl first? For generating the yamls you could use dry-run in debug mode. For example:

helm install . --dry-run --debug --generate-name

This should output the generated resources on your screen. Then copy the crd which wasnt defined in the previous release into a separate yaml-file (i.e. customResourceDefinition.yaml) and install it manually by using kubectl:

kubectl apply -f ./customResourceDefinition.yaml

After that you could try the helm upgrade command again. Maybe the upgrade command is really strict and every resource has to exist before any action is taken.

This is only a workaround and a guess. I havent had this problem before and didnt used the helm upgrade at all. Hope it helps :)

-- snukone
Source: StackOverflow

2/14/2020

I am using helm version 2.15.*. This seems to be a bug on helm (or Tiller). The option --cleanun-on-fail does not seem to work either. I use to delete the resource that's complaining about and run the helm upgrade again but I find it annoying having to do this repeatedly. What works for me is adding the option --atomic. If provided, the upgrade process rolls back changes made in case of failed upgrade.

The seems to be an issue with Tiller(server-side db) getting corrupted. See discussion here in github: https://github.com/helm/helm/issues/6031

-- alltej
Source: StackOverflow