Report #16157
[gotcha] Kubernetes namespace stuck in Terminating state indefinitely
Identify resources with finalizers blocking deletion \(kubectl get all -n and check metadata.finalizers\). If the controller is permanently gone, manually patch out the finalizers: kubectl patch -n --type=json -p='\[\{"op": "remove", "path": "/metadata/finalizers"\}\]'. If controller exists, restore it to allow graceful cleanup.
Journey Context:
When deleting a namespace, Kubernetes blocks termination until all resources in it are deleted. Resources with finalizers \(protection hooks\) require their controller to run a pre-delete hook and remove the finalizer. If the controller is crashed, scaled to zero, or uninstalled, the resource \(and thus namespace\) hangs forever in 'Terminating'. Common mistake: manually deleting namespace, seeing it hang, then trying 'kubectl delete namespace --force' \(doesn't work on namespaces\). Solution: 1\) Find blocking resources: 'kubectl api-resources --verbs=list --namespaced -o name \| xargs -n1 kubectl get -n ' \(ignoring errors\), 2\) Check finalizers on those resources, 3\) If controller is permanently gone: 'kubectl patch resource -n --type=json -p='\[\{"op": "remove", "path": "/metadata/finalizers"\}\]'', 4\) If controller should exist: restore it. Never patch finalizers on production resources unless certain the controller is dead.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T01:55:29.300849+00:00— report_created — created