Helm uninstall: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
No edit summary
Line 20: Line 20:


Remove all associated resources and mark the release as deleted, but retain the release history.
Remove all associated resources and mark the release as deleted, but retain the release history.
=Keep a Resource from Being Uninstalled=
{{External|https://helm.sh/docs/howto/charts_tips_and_tricks/#tell-helm-not-to-uninstall-a-resource}}
Helm uninstalls by defaults all resources created by the chart for the release being uninstalled. There are cases when we may want to keep resources around: one case is when we want to keep a PersistentVolumeClaim because deleting it would make the a PersistentVolume outside of our control unavailable for binding for the subsequent release.
To indicate to Helm that a resource should be kept on uninstall, use the "helm.sh/resource-policy" annotation in template:
<syntaxhighlight lang='yaml'>
kind: Something
  annotations:
    "helm.sh/resource-policy": keep
</syntaxhighlight>
The "helm.sh/resource-policy" instructs helm to skip deleting the resource on uninstall, upgrade or rollback operation.
Note that this resource becomes orphaned, it will be no longer be managed by Helm. This can lead to problems if using helm install --replace on a release that has already been uninstalled, but has kept resources.

Revision as of 20:55, 4 September 2020

External

Internal

Overview


Revised for Helm 3


helm uninstall was introduced in Helm 3, and it is the replacement of helm delete, which still works as an alias.

helm uninstall <release-name>

The command removes by default the release history. To keep the release history, use --keep-history.

Options

--keep-history

Remove all associated resources and mark the release as deleted, but retain the release history.


Keep a Resource from Being Uninstalled

https://helm.sh/docs/howto/charts_tips_and_tricks/#tell-helm-not-to-uninstall-a-resource

Helm uninstalls by defaults all resources created by the chart for the release being uninstalled. There are cases when we may want to keep resources around: one case is when we want to keep a PersistentVolumeClaim because deleting it would make the a PersistentVolume outside of our control unavailable for binding for the subsequent release.

To indicate to Helm that a resource should be kept on uninstall, use the "helm.sh/resource-policy" annotation in template:

kind: Something
  annotations:
    "helm.sh/resource-policy": keep

The "helm.sh/resource-policy" instructs helm to skip deleting the resource on uninstall, upgrade or rollback operation.

Note that this resource becomes orphaned, it will be no longer be managed by Helm. This can lead to problems if using helm install --replace on a release that has already been uninstalled, but has kept resources.