Kubernetes Pod Stuck "Terminating" - Fix Finalizers and Stuck Deletes in CI
A pod enters Terminating when deletion starts, but it only disappears once its containers stop and all finalizers are removed. It hangs when a finalizer never clears, the process ignores SIGTERM past the grace period, or the node is unreachable.
What this error means
A pod shows STATUS: Terminating long past its terminationGracePeriodSeconds and a CI step waiting on its deletion hangs. kubectl get pod -o yaml still lists a metadata.deletionTimestamp and often a lingering metadata.finalizers entry.
$ kubectl get pod api-...
NAME READY STATUS RESTARTS AGE
api-... 1/1 Terminating 0 12m
# metadata.finalizers: ["example.com/cleanup"] ← never removedCommon causes
A finalizer never clears
A controller/operator finalizer (e.g. a cleanup hook) is responsible for removing itself after teardown. If that controller is down or erroring, the finalizer stays and the pod cannot be removed.
Process ignores SIGTERM
The container does not handle SIGTERM and runs until the grace period, then is SIGKILLed - but if PID 1 reaps improperly or hangs, termination drags out.
Node unreachable
If the node hosting the pod is NotReady/unreachable, the control plane cannot confirm the containers stopped, so the pod sits in Terminating until the node recovers or is removed.
How to fix it
Identify what is holding deletion
Check for a stuck finalizer and the node’s health before forcing anything.
kubectl get pod <pod> -o jsonpath='{.metadata.finalizers}'; echo
kubectl get pod <pod> -o jsonpath='{.spec.nodeName}'; echo
kubectl get nodesClear the real blocker, not just force-delete
- If a finalizer is stuck, restore the controller that owns it so it removes the finalizer cleanly.
- If the node is unreachable, recover or remove the node so the control plane can finalize deletion.
- Fix the app to handle SIGTERM so it shuts down within the grace period.
How to prevent it
- Handle SIGTERM in apps so they exit within
terminationGracePeriodSeconds. - Keep finalizer-owning controllers/operators healthy so finalizers clear on delete.
- Monitor node health so unreachable nodes are remediated quickly.