Kubernetes tip: Force delete terminating pod

How to get rid of pods that are stuck in the "Terminating" state

Kubernetes tip: Force delete terminating pod

Here’s a really quick tip about an annoying Kubernetes issue I’ve encountered from time to time while updating my deployments.

Sometimes, for obscure reasons, pods get stuck in the “Terminating” state. There’s an open issue about this on Github.

It can apparently happen because of a lack of memory, timeouts, issues with volumes, etc. Since the issue is not resolved, there are only workarounds at this time.

The one that has worked for me is the following:

kubectl delete pods <pod> --grace-period=0 --force

This kills the problematic pods (pretty violently). Personally I only do this on my development workstation, so it’s all right. But be careful if you use this on a production system ;-)

That's it for today! ✨

About Sébastien

Hello everyone! I'm Sébastien Dubois. I'm an author, founder, and CTO. I write books and articles about software development & IT, personal knowledge management, personal organization, and productivity. I also craft lovely digital products 🚀

If you've enjoyed this article and want to read more like this, then subscribe to my newsletter, check out my PKM Library and my collection of books about software development 🔥.

You can follow me on Twitter 🐦

If you want to discuss, then don't hesitate to join one of my communities: the Software Crafters community, the Personal Knowledge Management community, and the focusd Productivity community