Last active
May 12, 2022 19:28
-
-
Save ZeroDeth/b3255896f9ba5b4ae716b486dac5554c to your computer and use it in GitHub Desktop.
Script to force remove Kubernetes Namespace Finalizer
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
#!/bin/bash | |
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 ns $namespace -o json | jq '.spec.finalizers = []' | kubectl replace --raw "/api/v1/namespaces/$namespace/finalize" -f - |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment