Troubleshooting guide
Kubernetes pod stuck in Terminating: how to fix it
A pod stays in Terminating until the kubelet confirms it is gone and all finalizers are removed. If one of those never happens, it waits indefinitely.
3 min read10 sectionsUpdated
On this page
Common causes
- A finalizer waiting on a controller that is gone.
- The node is down or partitioned, so the kubelet cannot confirm anything.
- Volumes that will not unmount, such as a hung NFS mount.
- A very long
terminationGracePeriodSecondscombined with an app that ignores SIGTERM. - A stuck container runtime on the node.
# Finalizers and grace period
kubectl get pod my-pod -o jsonpath='{.metadata.finalizers}{"\n"}{.spec.terminationGracePeriodSeconds}{"\n"}'
# Is the node healthy?
kubectl get node $(kubectl get pod my-pod -o jsonpath='{.spec.nodeName}')
# On the node: is it still running, and are volumes stuck?
crictl ps --name my-container
mount | grep my-pod
journalctl -u kubelet --since "10 min ago" | grep my-pod | tailFixes
Fix the real blocker where possible: restore the node, or the controller that owns the finalizer. When you must proceed:
kubectl delete pod my-pod --grace-period=0 --force
That removes the record but does not prove the process stopped. For a StatefulSet, confirm the old pod is really dead first, because two pods writing to the same volume can corrupt data. Removing a finalizer by patch bypasses whatever cleanup it guarded, so check what it was for.
Order of shutdown
It helps to know the sequence. The pod is marked for deletion, its preStop hook runs, SIGTERM is sent, and the grace period counts down, covering the hook as well. If a preStop hook sleeps for 25 seconds with a 30-second grace period, the application gets only five. Long hooks are a frequent reason why shutdown takes longer than expected.
Catch it automatically
Alert on pods with a deletion timestamp older than their grace period plus a margin. Graceful shutdown belongs in every service too: see graceful shutdown in Kubernetes. Rollouts that slow down with time usually come from this.
Is force-deleting a pod safe?
For stateless pods, generally yes. For stateful workloads, confirm the old process is gone first to avoid two writers.
What is a finalizer?
A marker that makes Kubernetes wait until a controller has finished cleanup before the object is removed.
Why does kubectl delete hang?
It waits for the deletion to complete. Use --wait=false to return immediately.
Related reading
- Kubernetes pod stuck in Pending: how to fix it: Fix Kubernetes pods stuck in Pending: insufficient CPU or memory, taints, node selectors and unbound PersistentVolumeClaims, using scheduler events.
- Kubernetes CrashLoopBackOff: how to fix it: Fix CrashLoopBackOff step by step: read the previous container’s logs and exit code, then solve bad config, failing probes, OOM kills or missing secrets.
- Kubernetes readiness probe failed: how to fix it: Fix Kubernetes readiness and liveness probe failures: slow startup, wrong ports, overloaded health endpoints and dependency checks that cause cascading outages.
- Celery tasks stuck in PENDING: how to fix it: Fix Celery tasks stuck in PENDING or never running: wrong queues, unregistered tasks, blocked workers and visibility timeouts, with celery inspect commands.
- Kubernetes HPA not scaling: how to fix it: Fix a Kubernetes HorizontalPodAutoscaler that will not scale: unknown metrics, missing CPU requests, metrics-server issues, tolerance and stabilization windows.
- Kubernetes ImagePullBackOff: causes and how to fix it: Fix ImagePullBackOff and ErrImagePull in Kubernetes: wrong tags, private registry credentials, rate limits and network problems, with kubectl commands.
Watch your own site and services with VitalRix
Uptime checks, APM, logs, real-user monitoring, alerts and status pages in one place. Every product has a free tier and no credit card is needed.