Kubernetes namespace is stuck in terminating status.
This usually happens due to the finalizer
$ kubectl get ns
NAME STATUS AGE
cert-manager Active 14d
custom-metrics Terminating 7d
default Active 222d
nfs-share Active 15d
ingress-nginx Active 103d
kube-public Active 222d
kube-system Active 222d
lb Terminating 4d
monitoring Terminating 6d
production Active 221d
3
Answers
This worked for me :
kubectl get namespace linkerd -o json > linkerd.json
Where:/api/v1/namespaces/<your_namespace_here>/finalize
kubectl replace --raw "/api/v1/namespaces/linkerd/finalize" -f ./linkerd.json
This is what worked for me:
kubectl get namespace monitoring -o json > monitoring.json
remove "kubernetes" from finalizers array.
kubectl replace --raw "/api/v1/namespaces/monitoring/finalize" -f ./monitoring.json
I have made this a script which is handy for me.