Skip to content

Instantly share code, notes, and snippets.

@zerodayyy
Last active November 1, 2021 10:18
Show Gist options
  • Save zerodayyy/30c43ec1270a68d4dfbba02887cf4a04 to your computer and use it in GitHub Desktop.
Save zerodayyy/30c43ec1270a68d4dfbba02887cf4a04 to your computer and use it in GitHub Desktop.
Kill stuck Kubernetes namespace

This snippet allows you to kill a Kubernetes Namespace that is stuck in Terminating state:

(
NAMESPACE=your-stuck-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
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment