Skip to content

Instantly share code, notes, and snippets.

@arsham
Created January 25, 2019 15:20
Show Gist options
  • Save arsham/48b6f3cb1e6f0cf0bd50fd609cf7679b to your computer and use it in GitHub Desktop.
Save arsham/48b6f3cb1e6f0cf0bd50fd609cf7679b to your computer and use it in GitHub Desktop.
Clear terminating namespaces (runaway) on #kubernetes
kubectl proxy
kubectl get ns | grep Terminating | awk '{print $1}' | xargs  -n1 -- bash -c 'kubectl get ns "$0" -o json | jq "del(.spec.finalizers[0])" > "$0.json"; curl -k -H "Content-Type: application/json" -X PUT --data-binary @"$0.json" "http://127.0.0.1:8001/api/v1/namespaces/$0/finalize" '
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment