1
votes

In case of failed upgrade, once I fix the issue then I get this message almost all the time:

Failed to install app myapp. Error: UPGRADE FAILED: kind 'some kind' with the name "some-name" 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

This means that some K8s resource was installed via the initial failed upgrade and the new upgrade tries to install it again.

To fix this I had to delete the given resource. Then the upgrade went well.

What to do when I get this message almost for every resource? I have ~300 resource. I already deleted 5 resources but the above message continues to popup for other resources as well.
Of course I don't want to do it for the other X resources by hand.

What is the solution?

Why can't helm just redeploy/ignore those already installed resources?

In the current state it is impossible to perform a new upgrade after a failed one for a bigger application.

1
Are you using helm install or helm upgrade? - Kamol Hasan
Kamol Hasan : upgrade - beatrice
Which version of Helm? Can you provide a minimal reproducible example? If you think it's a bug in Helm, opening an issue in the Helm GitHub repository might be a better path to getting a resolution. - David Maze

1 Answers

0
votes

Use the Atomic flag Helm provides to rollback failed upgrades. That way, you will not have to manually cleanup the resources left by the failed upgrade every time.

helm upgrade --atomic

https://helm.sh/docs/helm/helm_upgrade/