Helm delete all releases
Kubernetes HelmKubernetes Helm Problem Overview
I'm trying find a way to delete all deployed releases in Helm.
It appears that Helm does not support deleting all releases, with --all
or otherwise.
Would there be another way to delete all Helm releases in one command?
Kubernetes Helm Solutions
Solution 1 - Kubernetes Helm
To delete all Helm releases in Linux(in Helm v2.X) with a single command, you can use some good old bash. Just pipe the output of helm ls --short
to xargs
, and run helm delete
for each release returned.
helm ls --all --short | xargs -L1 helm delete
Adding --purge
will delete the charts as well, as per @Yeasin Ar Rahman's comment.
helm ls --all --short | xargs -L1 helm delete --purge
On Windows, you can delete all releases with this command, again, with --purge
deleting the charts as well.
helm del $(helm ls --all --short) --purge
Solution 2 - Kubernetes Helm
For helm 3 you have to provide namespaces so there is an awk
step before xargs
:
helm ls -a --all-namespaces | awk 'NR > 1 { print "-n "$2, $1}' | xargs -L1 helm delete
This results in commands like:
helm delete -n my-namespace my-release
Solution 3 - Kubernetes Helm
This worked for me in a powershell cmd window:
helm del $(helm ls --all --short) --purge
Solution 4 - Kubernetes Helm
helm delete $(helm ls --short)
Description:
helm ls --short
gives a list of releases ids.
helm delete id1 id2 id3
deletes releases with ids: id1
, id2
, id3
.
So combining them we get:
helm delete $(helm ls --short)
Solution 5 - Kubernetes Helm
I regularly delete all releases in Helm too, so I thought it'd be useful to make a Helm plugin for it.
Install:
helm plugin install https://github.com/tedmiston/helm-delete-all-plugin --version 0.0.3
(You may be able to omit the --version x
part on newer versions of Helm.)
Usage:
helm delete-all
Solution 6 - Kubernetes Helm
There is a really good plugin for delete all helm releases from all namespaces (The previous plugin in this post doesn't work for me) . Install:
helm plugin install https://github.com/BarelElbaz/helm-delete-all
usage:
helm delete-all
you can provide more flags such as --deletePersistent
for delete PVCs
or skipping a specific namespace by --except-namespace