How to delete namespace that is stuck in terminating state
Ashutosh Rathore
1 min read
Get namespace that has terminating state:
Kubectl get ns | grep terminating
Delete the namespace forcefully using the below cmd line
NS=`kubectl get ns |grep Terminating | awk 'NR==1 {print $1}'` && kubectl get namespace "$NS" -o json | tr -d "\n" | sed "s/\"finalizers\": \[[^]]\+\]/\"finalizers\": []/" | kubectl replace --raw /api/v1/namespaces/$NS/finalize -f -
0
Subscribe to my newsletter
Read articles from Ashutosh Rathore directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by