Force delete a kubernetes namespace
Sometimes a Kubernetes namespace can get stuck in a Terminating state due to lingering finalizers or custom resources.
When that happens, you can force delete it using the following steps:
🧩 Steps to force delete a namespace
(
NAMESPACE=your_cheeky_ns
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 \
http://127.0.0.1:8001/api/v1/namespaces/$NAMESPACE/finalize
)