Skip to content

Instantly share code, notes, and snippets.

@nebril
Created February 20, 2020 19:23
Show Gist options
  • Save nebril/4610c03b78137ed2bee4d2d13f55089c to your computer and use it in GitHub Desktop.
Save nebril/4610c03b78137ed2bee4d2d13f55089c to your computer and use it in GitHub Desktop.
Delete all terminating namespaces in k8s cluster
kubectl get ns | grep Terminating | awk '{print $1}' | xargs -n 1 bash -c 'kubectl get ns -o json $1 | tr -d "\n" | sed "s/\"finalizers\": \[[^]]\+\]/\"finalizers\": []/" | kubectl replace --raw /api/v1/namespaces/$1/finalize -f -' -
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment