finalizers
finalizers copied to clipboard
[Feature request] Add ability to delete finalizers
Maybe something like this? https://medium.com/pareture/script-to-force-remove-kubernetes-namespace-finalizer-57b72bd9460d
I managed to delete all pending deletion resources blocked by a finalizer using this script:
finalizers | tail -n +2 | while read -r line; do
namespace=$(echo "$line" | awk '{print $1}')
name=$(echo "$line" | awk '{print $2}')
kind=$(echo "$line" | awk '{print $4}')
kubectl patch "$kind" "$name" -n "$namespace" --type=json -p='[{"op": "remove", "path": "/metadata/finalizers"}]'
done
finalizers | awk '{print "kubectl patch -n " $1 " " $4 "/" $2 " --type json --patch='\''[ { \"op\": \"remove\", \"path\": \"/metadata/finalizers\" } ]'\''" }' | sh -x