Report #58747
[gotcha] Kubernetes namespace stuck in Terminating due to orphaned finalizers
Identify the specific resource inside the namespace with pending finalizers \(kubectl get all -n and check CRDs\), verify the external resource is actually cleaned up, then patch that specific resource to remove the finalizer; never force-delete the namespace object itself until all child resources are cleared.
Journey Context:
When a Kubernetes namespace is deleted, the API server first deletes all resources within it. If a resource \(like a custom resource from an operator\) has a finalizer \(e.g., 'operator.example.com/cleanup'\), the resource cannot be deleted until the controller removes the finalizer after cleaning up external resources \(e.g., S3 buckets, cloud load balancers\). If the controller pod is deleted or broken before it removes the finalizer, the resource hangs in a 'deletionTimestamp' state. Because the namespace cannot be emptied, it stays in 'Terminating' indefinitely. The common mistake is to run 'kubectl delete namespace X --force' or to patch the namespace itself to remove its finalizer \(kubernetes finalizers are on the namespace object too\). This orphans the child resources in etcd and can leave cloud resources running. The correct fix is to identify which resource inside the namespace is stuck \(kubectl get all -n X, kubectl get crd, kubectl api-resources --verbs=list --namespaced -o name \| xargs kubectl get -n X\), check its finalizers, verify the external resource is actually deleted, then patch that specific resource to remove the finalizer. Only after all child resources are gone will the namespace terminate naturally.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T05:05:54.472268+00:00— report_created — created