Created
January 27, 2021 19:37
-
-
Save njgibbon/0540b9e6054d3ec64bad1fdc500ea4e9 to your computer and use it in GitHub Desktop.
Force removal of Kubernetes Namespace Finalizer(s).
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
set -eou pipefail | |
namespace=$1 | |
if [ -z "$namespace" ] | |
then | |
echo "This script requires a namespace argument input. None found. Exiting." | |
exit 1 | |
fi | |
kubectl get namespace $namespace -o json | jq '.spec = {"finalizers":[]}' > rknf_tmp.json | |
kubectl proxy & | |
sleep 5 | |
curl -H "Content-Type: application/json" -X PUT --data-binary @rknf_tmp.json http://localhost:8001/api/v1/namespaces/$namespace/finalize | |
pkill -9 -f "kubectl proxy" | |
rm rknf_tmp.json |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment