I want to remove pod that I deployed to my cluster with helm install
.
I used 3 ways to do so:
helm uninstall <release name>
-> remove the pod from the cluster and from the helm listhelm delete <release name>
-> remove the pod from the cluster and from the helm listkubectl delete -n <namespace> deploy <deployment name>
-> remove the pod from the cluster but not from the helm listWhat's the difference between them? Is one better practice then the other?
helm delete
is an alias for helm uninstall
and you can see this when you check the --help
syntax:
$ helm delete --help
...
Usage:
helm uninstall RELEASE_NAME [...] [flags]
kubectl delete ...
just removes the resource in the cluster.
Doing helm uninstall ...
won't just remove the pod, but it will remove all the resources created by helm when it installed the chart. For a single pod, this might not be any different to using kubectl delete...
but when you have tens or hundreds of different resources and dependent charts, doing all this manually by doing kubectl delete...
becomes cumbersome, time-consuming and error-prone.
Generally, if you're deleting something off of the cluster, use the same method you used to install it in the first place. Namely, if you used helm install
or helm upgrade --install
to install it into the cluster, use helm uninstall
to remove it (or helm delete --purge
if you're still running Helm v2); and if you used kubectl create
or kubectl apply
, use kubectl delete
to remove it.