Created
April 15, 2021 09:43
-
-
Save ybelleguic/575cc8a6021acad5855a9e0108075b7a to your computer and use it in GitHub Desktop.
Cleanup k8s namespace
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
#From https://stackoverflow.com/questions/52369247/namespace-stuck-as-terminating-how-do-i-remove-it#:~:text=This%20is%20caused%20by%20resources,controller%20is%20unable%20to%20remove.&text=You%20can%20edit%20namespace%20on,enter%20or%20save%2Fapply%20changes. | |
function cleanup-ns() { | |
NS=$1 | |
kubectl get namespace $NS -o json \ | |
| tr -d "\n" | sed "s/\"finalizers\": \[[^]]\+\]/\"finalizers\": []/" \ | |
| kubectl replace --raw /api/v1/namespaces/$NS/finalize -f - | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment