Skip to content

Instantly share code, notes, and snippets.

@xoanmi
Last active May 24, 2024 18:33
Show Gist options
  • Save xoanmi/5e12e0b3f90d1a62a721a2b3ba4122ed to your computer and use it in GitHub Desktop.
Save xoanmi/5e12e0b3f90d1a62a721a2b3ba4122ed to your computer and use it in GitHub Desktop.
How to delete multiple kubernetes finalizers
#!bin/bash
# https://kubernetes.io/blog/2021/05/14/using-finalizers-to-control-deletion/
RESOURCES=$(kubectl get ns --no-headers -o custom-columns=":metadata.name")
for n in $RESOURCES
do
kubectl patch ns $n \
--type json \
--patch='[ { "op": "remove", "path": "/metadata/finalizers" } ]'
done
@spencercjh
Copy link

spencercjh commented Apr 2, 2024

kubectl get sth. --no-headers -o name

then do kubectl patch $n

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment