Skip to content

Instantly share code, notes, and snippets.

@ZeroDeth
Last active May 12, 2022 19:28
Show Gist options
  • Save ZeroDeth/b3255896f9ba5b4ae716b486dac5554c to your computer and use it in GitHub Desktop.
Save ZeroDeth/b3255896f9ba5b4ae716b486dac5554c to your computer and use it in GitHub Desktop.
Script to force remove Kubernetes Namespace Finalizer
#!/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