grizzthedj
grizzthedj

Reputation: 7505

Helm delete all releases

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?

Upvotes: 69

Views: 129537

Answers (8)

hbceylan
hbceylan

Reputation: 1282

If you use xargs in the alpine container then you will get the following error;

xargs: unrecognized option: L

So, you can use the following command to delete all releases in a specific namespace for the helm v3.

helm uninstall -n <namespace> $(helm ls --short -n <namespace>)

Upvotes: 4

Başar S&#246;ker
Başar S&#246;ker

Reputation: 726

To delete all releases in a particular namespace

helm ls  --short  -n <<namespace>> | xargs -L1 helm uninstall  -n <<namespace>>

Upvotes: 1

grizzthedj
grizzthedj

Reputation: 7505

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.

Upvotes: 102

Barel elbaz
Barel elbaz

Reputation: 656

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

Upvotes: 1

Taylor D. Edmiston
Taylor D. Edmiston

Reputation: 13036

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

https://github.com/tedmiston/helm-delete-all-plugin

Upvotes: 3

iimos
iimos

Reputation: 5037

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)

Upvotes: 18

jhnclvr
jhnclvr

Reputation: 9507

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

Upvotes: 32

Rod
Rod

Reputation: 396

This worked for me in a powershell cmd window:

helm del $(helm ls --all --short) --purge

Upvotes: 17

Related Questions