Last active
October 2, 2023 12:44
-
-
Save philoserf/24d32682672de41c5726972bf7ceaf23 to your computer and use it in GitHub Desktop.
remove kubernetes namespace stuck in termiinating status
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
for ns in $(kubectl get ns --field-selector "status.phase=Terminating" --output "jsonpath='{.items[*].metadata.name}'"); do | |
kubectl get ns "${ns}" --output json | | |
jq '.spec.finalizers = []' | | |
kubectl replace --raw "/api/v1/namespaces/${ns}/finalize" --filename - | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment