Back

Explore Courses Blog Tutorials Interview Questions
0 votes
1 view
in DevOps and Agile by (29.3k points)
edited by

The situation

I have a kubernetes pod stuck in "Terminating" state that resists pod deletions

NAME READY STATUS RESTARTS AGE ... funny-turtle-myservice-xxx-yyy 1/1 Terminating 1 11d ...

Where funny-turtle is the name of the helm release that has since been deleted.

What I have tried

try to delete the pod.

Output:

pod "funny-turtle-myservice-xxx-yyy" deleted

Outcome: it still shows up in the same state. - also tried with --force --grace-period=0, the same outcome with extra warning

Immediate deletion does not wait for confirmation that the running resource has been terminated. The resource may continue to run on the cluster indefinitely.

try to read the logs (kubectl logs ...).

Outcome:

Error from server (NotFound): nodes "ip-xxx.yyy.compute.internal" not found

try to delete the kubernetes deployment.

but it does not exist.

So I assume this pod somehow got "disconnected" from the aws API, reasoning from the error message that kubectl logs printed.

I'll take any suggestions or guidance to explain what happened here and how I can get rid of it.

EDIT 1

Tried to see if the "ghost" node was still there (kubectl delete node ip-xxx.yyy.compute.internal) but it does not exist.

1 Answer

0 votes
by (50.2k points)

For removing the finalizers in the pod we use the following command 

kubectl patch pod <pod-name> -p '{"metadata":{"finalizers":null}}'
This syntax is used to terminate the pod that is stuck in your case.

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
asked Feb 10, 2020 by anmolj (9k points)
0 votes
1 answer
Welcome to Intellipaat Community. Get your technical queries answered by top developers!

28.4k questions

29.7k answers

500 comments

94.1k users

Browse Categories

...