I've had a "stuck" namespace that I deleted showing in this eternal "terminating" status.
Assuming you've already tried to force-delete resources like: Pods stuck at terminating status, and your at your wits' end trying to recover the namespace...
You can force-delete the namespace (perhaps leaving dangling resources):
(
NAMESPACE=your-rogue-namespace
kubectl proxy &
kubectl get namespace $NAMESPACE -o json |jq '.spec = {"finalizers":[]}' >temp.json
curl -k -H "Content-Type: application/json" -X PUT --data-binary @temp.json 127.0.0.1:8001/api/v1/namespaces/$NAMESPACE/finalize
)
This is a refinement of the answer here, which is based on the comment here.
I'm using the jq
utility to programmatically delete elements in the finalizers section. You could do that manually instead.
kubectl proxy
creates the listener at 127.0.0.1:8001
by default. If you know the hostname/IP of your cluster master, you may be able to use that instead.
The funny thing is that this approach seems to work even when using kubectl edit
making the same change has no effect.