DEV Community

loading...

How to delete Kubernetes pods hanging in Terminating state

Arun Kumar Singh
In quest of understanding How Systems Work !
・1 min read

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

Discussion (0)