Juned Memon
Juned Memon Good for nothing

How to delete the dangling namespace in kubernetes

How to delete the dangling namespace in kubernetes

How to delete the dangling namespace in kubernetes

If you have got a dangling namespace which in Terminating state forever like below

1
2
NAME                STATUS        AGE
test-solutions   Terminating   7d1h

You can get rid of them using simple hack below, Reference 1

1
2
3
4
5
6
(
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
)

comments powered by Disqus