Monday 13 August 2018

Did You Face Pods Stuck On Terminating Issue While Deleting The Namespace In Kubernetes ?

ad300
Advertisement
You might have faced a situation of "Pods getting stuck on terminating" issue when trying to delete the namespace. This could be irritating especially when you might need the namespace delete results instantly.









No Problem, Kubernetes has provided a way to deal with this situation. We need to force delete the pod providing the pod name and namespace

Force Delete Command➤

< kubectl delete pod "podname" -n "namespace" --grace-period=0 --force >

Now, What if you have 10 to 20 Pods listed in "terminating status" even when you have issued a delete namespace command. So Now, You may need to force delete all of them one by one. 

But deleting them manually could be a cumbersome job and needs a lot of patience.

Well, there is a way where you can deal with this situation as well:

Code 1➤ Groovy Code to force delete multiple pods

Code 2➤ Shell Script Code to force delete multiple pods



Share This
Latest
Next Post

Welcome to my blog, I am Subhash Junas, I have been working on Core Java, Ruby, Selenium, Cucumber and on various automation technologies from past couple of years. I love to work on new challenges, solving problems and obstacles.

1 comment:

  1. Fixing this issue is complex since Node draining in Kubernetes must be configured in a way to work for your environment. You can use Shoreline debbugging tool. Shoreline’s Pods Stuck in Terminating Op Pack talks to Kubernetes master and checks on various pod states and determines if a pod has been terminating for too long. This is done by cordoning, draining, and then terminating the node so that it is safely cleaned up so that it is not impacting other software.

    ReplyDelete