Report #17461
[gotcha] Kubernetes namespace stuck in Terminating due to orphaned finalizers on resources with deleted controller
Identify remaining resources in the namespace via API, then patch them to remove finalizers using \`kubectl patch -p '\{"metadata":\{"finalizers":\[\]\}\}' --type=merge\`; if the resource object is already gone from etcd but the namespace metadata still lists it, patch the namespace object itself
Journey Context:
When deleting a namespace, Kubernetes blocks completion until all resources are deleted. If a resource has a finalizer \(e.g., \`foregroundDeletion\`, \`kubernetes.io/pvc-protection\`, or custom operator finalizers\), it waits for a controller to remove the finalizer. If the operator was deleted \*before\* the namespace \(common in CI/CD teardown or manual cleanup\), the finalizer remains indefinitely. Users try \`kubectl delete ns --force\` which fails because it doesn't bypass finalizers on the resources inside. The only resolution is to manually patch the stuck resources \(found via \`kubectl api-resources --verbs=list --namespaced -o name \| xargs -n1 kubectl get -n 2>/dev/null\`\) to clear finalizers, or if the resource is already gone from etcd but the namespace metadata still shows it, patch the namespace itself.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T05:23:53.206573+00:00— report_created — created