#devops #kubernetes

Sometimes, when you deploy something to Kubernetes, you end up with a pod which stays in the "Terminating" phase. Very annoying as whatever you do in your Kubernetes client or via kubectl delete, the pod just stays there.

The first thing you can try is to set the termination grace period to 0:

1$ kubectl delete pod <pod_name> -n <namespace> --grace-period 0

If that doesn't work, your last resort is to force the operation:

1$ kubectl delete pod <pod_name> -n <namespace> --grace-period 0 --force

You should however only do that if you are certain the pod is no longer running. If the pod is still running while you forcefully delete it, it may continue to run in the cluster indefinitely.

You can find more information about this in the Kubernetes documentation.

You can find quite a number of handy tips and tricks here which were kindly provided by Mariusz from SpaceLift.