top of page

Delete namespace in TCA Kubernetes cluster stuck in a terminating state?

Use the command below without any changes. it will work like a charm.

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 -

This script removes the finalizers in the problematic namespace and remove first terminating namespace in your list. Eg. if you have 3 namespaces by terminating status in the environment then you should run this command 3 times.

13 views0 comments

Recent Posts

See All
bottom of page