Last active
May 10, 2021 11:33
-
-
Save snobu/4c3f344025f4e8af927f10994ffc2597 to your computer and use it in GitHub Desktop.
cleanup-k8s-terminating-namespace.sh
This file contains 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
#!/bin/bash | |
# Usage ./cleanup-k8s-terminating-namespace.sh <namespace> | |
NAMESPACE=$1 | |
echo Cleaning up namespace $1 | |
kubectl proxy & | |
kubectl get namespace $NAMESPACE -o json |jq '.spec = {"finalizers":[]}' > /tmp/temp.json | |
curl -i -k -H "Content-Type: application/json" -X PUT \ | |
--data-binary @/tmp/temp.json 127.0.0.1:8001/api/v1/namespaces/$NAMESPACE/finalize | |
rm /tmp/temp.json | |
pkill kubectl |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Easier -
Remove all
finalizers
. Save.