Skip to content

Instantly share code, notes, and snippets.

@rodrigo-galba
Created September 30, 2021 17:50
Show Gist options
  • Save rodrigo-galba/9025b4eb4ea2809e488e79de8c0f9e39 to your computer and use it in GitHub Desktop.
Save rodrigo-galba/9025b4eb4ea2809e488e79de8c0f9e39 to your computer and use it in GitHub Desktop.
Kubernetes - force remove hanging namespace
sudo apt install jq
(
NAMESPACE=hanging-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