Report #42257
[gotcha] Kubernetes Namespace stuck in 'Terminating' state indefinitely
Identify resources with pending finalizers using 'kubectl get -n -o yaml \| grep finalizers', then either resolve the external dependency \(e.g., delete the external cloud resource\) or patch the resource to remove the finalizer using 'kubectl patch' with 'merge' type setting finalizers to empty array; as last resort, use 'kubectl proxy' and 'curl -X PUT' on the namespace subresource to force remove finalizers
Journey Context:
When a namespace is deleted, Kubernetes first deletes all resources within it. If a resource has a finalizer \(a metadata field\), the Kubernetes controller blocks deletion until the finalizer is removed by an external controller \(e.g., a cloud provider cleaning up a load balancer\). If the external controller fails or is uninstalled, the resource hangs, blocking the namespace termination. Users often try 'kubectl delete namespace --force' which doesn't work because finalizers are enforced by the API server. The correct approach requires understanding that finalizers are part of the object's metadata and must be cleared by the responsible controller or manually via API manipulation, not standard kubectl delete flags.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T01:23:59.389850+00:00— report_created — created