Skip to content

Instantly share code, notes, and snippets.

@woodcockjosh
Last active November 27, 2020 19:14
Show Gist options
  • Save woodcockjosh/1585787d55c68a3af60d504115bb926a to your computer and use it in GitHub Desktop.
Save woodcockjosh/1585787d55c68a3af60d504115bb926a to your computer and use it in GitHub Desktop.
# 1. Open Shell window 1
namespace="annoying-namespace-to-delete"
# 2. Dump the namespace into a data file
kubectl get namespace ${namespace} -o json > tmp.json
# 3. Edit the namespace manually and make all the finalizers an empty array
# 4. Start kubectl proxy so we can use curl commands instead of kubectl (which doesn't work)
kubectl proxy --port=8787
# 5. Open another terminal and go to the directory you dumped tmp.json into
namespace="annoying-namespace-to-delete"
# 6. Make REST request to PUT the updated json in the k8s master
curl -k -H "Content-Type: application/json" -X PUT --data-binary @tmp.json http://127.0.0.1:8787/api/v1/namespaces/${namespace}/finalize
# 7. Cancel kubectl proxy in shell window 1
# 8. High five yourself!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment