Pods stuck in Terminating for 20 minutes on every rollout of one deployment Troubleshooting
One deployment out of about forty takes roughly twenty minutes for old pods to disappear on every rollout. terminationGracePeriodSeconds is the default 30. The rest of the cluster rolls in seconds. kubectl describe on a stuck pod shows nothing obviously wrong, the containers show as not running, and the pod just sits in Terminating until it eventually goes. Node pressure is fine and the app itself has no long-running requests.
@idempotent_ian · last mo. · 3 replies
Containers not running but the pod still Terminating means the container runtime is done and something else is holding the pod object or the node's cleanup. Three things to check, in this order.
Finalizers first:
kubectl get pod <name> -o jsonpath='{.metadata.finalizers}'. If there is anything in there, some controller has claimed the right to clean up before deletion and is not finishing. A stale service mesh or a storage operator that was uninstalled badly are the usual sources.Then volume unmount. Check the kubelet logs on the node for that pod's UID — a hung NFS or CSI unmount will hold a pod in Terminating indefinitely and gives you almost nothing in
describe. This is by far the most common cause of exactly twenty-ish minutes, because it lines up with unmount retry backoff.Third, sidecars. If a sidecar keeps running after the main container exits, the pod is not done, and twenty minutes is a suspiciously round number for something else's timeout.
Reply
Report
@first_repo_finn · last mo.
Finalizer from a mesh we removed two months ago, still on that one deployment's pods because the template was never updated. Removed it and rollouts are seconds now.
Reply
Report
@pinned_versions · last mo.
Worth grepping the whole cluster for that finalizer while you are there. If one deployment kept it, others probably did too and just have not rolled yet.
Reply
Report