google cloud platform

What is the purpose of –purge flag in helm delete command ?

This tutorial clarifies the purpose of –purge flag in helm delete command and alternative way to retain release history.

Purpose of –purge flag in helm delete command

Before Helm V3 you can use flag –purge in the helm delete command as shown below.

$ helm delete demo --purge

The above command uses the release name (demo) and uninstalls the release.

If you don’t use the –-purge flag, it removes all of the resources associated with the last release of the helm chart as well as the release history and make sure that it frees up for future use.

The purpose of –purge flag is to remove the release name information completely and make it available for the re-use later. Otherwise you may get kind of following error if you try to install with the same name which exists in the release history.

Error: cannot re-use a name that is still in use

Error: unknown flag: –purge

Note, From Helm v3 –purge is no longer needed. And when you try to use –purge you will get the following error.

$ helm delete demo --purge

Error: unknown flag: --purge

If you would like to retain any release information/ history, then you need to use –keep-history flag as shown below.

$ helm delete demo --keep-history
 
release "demo" uninstalled
 
$ helm ls -a
 
NAME    NAMESPACE       REVISION        UPDATED                                 STATUS          CHART           APP VERSION
demo    default         1               2021-04-05 11:19:59.395317133 +0000 UTC uninstalled     demo-1.0.1

Note, the command helm delete has been renamed to helm uninstall.

$ helm uninstall demo --keep-history

release "demo" uninstalled

$ helm ls -a

NAME    NAMESPACE       REVISION        UPDATED                                 STATUS          CHART           APP VERSION
demo    default         1               2021-04-05 11:55:01.941627331 +0000 UTC uninstalled     demo-1.0.1

That’s it. You had learn how to delete (uninstall) specific helm chart resource and the purpose of using –purge / –keep-history flag options.

Hope it helped 🙂

You’ll also like:

References

Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments