Namespace stuck in termination
Jump to navigation
Jump to search
for ns in $(kubectl get ns --field-selector status.phase=Terminating -o jsonpath='{.items[*].metadata.name}'); do kubectl get ns $ns -ojson | jq '.spec.finalizers = []' | kubectl replace --raw "/api/v1/namespaces/$ns/finalize" -f -; done for ns in $(kubectl get ns --field-selector status.phase=Terminating -o jsonpath='{.items[*].metadata.name}'); do kubectl get ns $ns -ojson | jq '.metadata.finalizers = []' | kubectl replace --raw "/api/v1/namespaces/$ns/finalize" -f -; done
As editing namespace finalizers doesn't work sometimes.
kubectl edit namespace my-namespace # look for finalizer list
https://stackoverflow.com/questions/65667846/namespace-stuck-as-terminating