Last active
May 16, 2022 12:47
-
-
Save jakoberpf/7f4e21be24de56f4c39abc77c9f1480b to your computer and use it in GitHub Desktop.
This script will terminate a given namespace, even if its stuck in the terminating state. Note that this will not trigger any ressource cleanup.
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
echo ATTENTION: THIS IS UNSAFE! | |
echo Which namespace would you like me to terminate\? | |
read NAMESPACE_TO_DESTROY | |
echo I will terminate namespace $NAMESPACE_TO_DESTROY\! | |
( | |
kubectl proxy & | |
kubectl get namespace $NAMESPACE_TO_DESTROY -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_TO_DESTROY/finalize | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment