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?
To remove the pods, list the pods with kubectl get pods and then delete the pods by name. To delete the Helm release, find the Helm release name with helm list and delete it with helm delete . You may also need to clean up leftover StatefulSets , since helm delete can leave them behind.
Synopsis. This command takes a release name and uninstalls the release. It removes all of the resources associated with the last release of the chart as well as the release history, freeing it up for future use. Use the '--dry-run' flag to see which releases will be uninstalled without actually uninstalling them.
When Helm installs a chart including a statefulset which uses volumeClaimTemplates to generate new PVCs for each replica created, Helm loses control on those PVCs.
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
Update: As per @lucidyan comment, the --purge
arg is not available in Helm v3.
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
This worked for me in a powershell cmd window:
helm del $(helm ls --all --short) --purge
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)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With