Namespace stuck in "Terminating" state
Last updated: June 2, 2025
A Kubernetes namespace stuck in a terminating state typically happens when Kubernetes is unable to clean up all resources in that namespace.
Need to describe namespace this will show up the reason why its stuck in terminating state
Most common scenario:
Customer delete tenant but k8s namespace still exists
Describe k8s namespace which is stuck in terminating state
kubectl describe ns {Namespace name}NamespaceDeletionDiscoveryFailure True Mon, 02 Jun 2025 10:08:23 +0530 DiscoveryFailed Discovery failed for some groups, 1 failing: unable to retrieve the complete list of server APIs: metrics.k8s.io/v1beta1: stale GroupVersion discovery: metrics.k8s.io/v1beta1
Get the status of metrics-server apiserver
kubectl get apiservice | grep metrics-serverv1beta1.metrics.k8s.io kube-system/metrics-server False (MissingEndpoints) 3m29s
Metrics-server not deployed:
if metrics server pod is stuck in pending state, delete metrics-server apiservice
kubectl delete apiservice v1beta1.metrics.k8s.io
Issue with metrics-server configuration:
If metrics-server deployment pod is in running state, it has configuration issue.
Easiest way to fix is to delete metrics-server deployment, wait for metrics-server pod to be in running state. Delete metrics-server k8s service.
Get the status of metrics-server apiservice:
kubectl get apiservice | grep metrics-serverv1beta1.metrics.k8s.io kube-system/metrics-server True 12m
Above apiservice status is changed from False (MissingEndpoints) to True
Verify namespace is deleted:
kubectl get ns | grep {namespace}