How to delete Kubernetes pods hanging in Terminating state

arunksingh16

Arun Kumar Singh

Posted on April 6, 2021

How to delete Kubernetes pods hanging in Terminating state

While working on Kubernetes environment you may see hanging PODs after termination. You will see the state of Terminating

$ kubectl get pods
 NAME        READY     STATUS        RESTARTS   AGE
 nginx       0/1       Terminating   0          1d
Enter fullscreen mode Exit fullscreen mode

This can hold your work for sometime. In these cases you need to find the root cause of this issue but in the mean time if you want to quickly get rid of those pods, run following command -

$ kubectl delete pod <pod-name> -n <namespace> --grace-period=0 --force
Enter fullscreen mode Exit fullscreen mode
💖 💪 🙅 🚩
arunksingh16
Arun Kumar Singh

Posted on April 6, 2021

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related