Answer a question

I want to remove pod that I deployed to my cluster with helm install.

I used 3 ways to do so:

  1. helm uninstall <release name> -> remove the pod from the cluster and from the helm list
  2. helm delete <release name> -> remove the pod from the cluster and from the helm list
  3. kubectl delete -n <namespace> deploy <deployment name> -> remove the pod from the cluster but not from the helm list

What's the difference between them? Is one better practice then the other?

Answers

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 the cluster, use the same method you used to install it in in the first place. If you used helm to install it into the cluster, use helm to remove it. If you used kubectl create or kubectl apply, use kubectl delete to remove it.

Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐