Skip to content

Instantly share code, notes, and snippets.

@chrisedrego
Created October 22, 2020 11:18
Show Gist options
  • Save chrisedrego/5ded371e3cd8d0c2be14f4b2c668dd71 to your computer and use it in GitHub Desktop.
Save chrisedrego/5ded371e3cd8d0c2be14f4b2c668dd71 to your computer and use it in GitHub Desktop.
force delete namespace
kubectl proxy &
echo "Entering the namespace details: "
read ns
cat<<EOF >./ns.json
{
"apiVersion": "v1",
"kind": "Namespace",
"metadata": {
"labels": {
"name": "$ns"
},
"name": "$ns"
},
"spec": {
"finalizers": [
]
}
}
EOF
kubectl delete ns/$ns &
curl -k -H "Content-Type: application/json" -X PUT --data-binary @ns.json http://127.0.0.1:8001/api/v1/namespaces/$ns/finalize
kilall kubectl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment