Forked from chrisedrego/force-namespace-destroy.sh
Created
December 25, 2024 10:38
-
-
Save mayooot/78b9ceabaebb7f43e88c7f818d27652a to your computer and use it in GitHub Desktop.
force delete namespace
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
LGTM