Delete Kubernetes Pods with One Command? Yes, You Can! In this blog post, we will show you how to do it.
Kubernetes is an open-source system for automating deployment, scaling and management of containerized applications. Kubernetes can be quite powerful if you know how to use it correctly. This blog post will walk you through the process of deleting all the Kubernetes pods running on your cluster using a single command.
Pods vs Deployment
Depending on the Pod object type, Pod or Deployments, you will use different commands to delete all the pods. Let’s start with Pods.
To delete all the pods deployed as Pod kind and not deployment, use the following command.
kubectl delete pods --all
I use the following command to delete all the Pods deployed using a Deployment kind. If you delete Pods that were deployed using the deployment kind with the above command (kubectl delete pods), the controller will recreate them, so it is essential to know when to use which command.
kubectl delete deploy --all