How To Fix Kubernetes Pod Stuck In Terminating [Solved]

Immediate Fix: Force Deleting the Pod

When a Kubernetes pod is stuck in the “Terminating” state, the quickest solution is to bypass the standard graceful shutdown sequence. Use the following command to force-delete the resource from the cluster’s state.

kubectl delete pod [POD_NAME] --namespace [NAMESPACE] --force --grace-period=0

The --force flag combined with --grace-period=0 tells the API server to remove the pod from ETCD immediately without waiting for the Kubelet to confirm the container has stopped.

Technical Explanation: Why Pods Get Stuck

A pod enters the “Terminating” state when the API server receives a deletion request. Normally, the Kubelet sends a SIGTERM signal to the process and waits for it to exit.

If the node hosting the pod is unreachable or the process ignores the termination signal, the pod remains in limbo. Kubernetes will not remove the object until the underlying resources are confirmed as released.

Cause Technical Description
Finalizers Metadata keys that must be cleared before the resource can be deleted.
Node Unreachable The Kubelet is unable to communicate with the API server due to network failure.
Zombies The container process has become a zombie and cannot respond to SIGKILL.

Troubleshooting a Kubernetes pod stuck in terminating state using a terminal command.

Alternative Methods

Patching Finalizers

If force deleting doesn’t work, the pod likely has “finalizers” defined in its metadata. You can manually strip these finalizers to allow the API server to finish the deletion.

kubectl patch pod [POD_NAME] -p '{"metadata":{"finalizers":null}}'

This command updates the pod’s JSON definition in real-time, removing any blockers that were preventing the resource from being reaped.

Cleaning Up Dead Nodes

If the pod is stuck because the node it resides on is “NotReady,” you may need to address the node status. Check your node health with the following command:

kubectl get nodes

If a node is permanently offline, deleting the node object itself will automatically trigger the cleanup of all pods associated with it, moving them to healthy nodes if they are part of a Deployment.