Interview Prep/Kubernetes/Control plane, RBAC, webhooks and autoscaling

A namespace is stuck `Terminating` and its status shows `NamespaceDeletionDiscoveryFailure: Discovery failed for some groups, 1 failing: unable to retrieve the complete list of server APIs: metrics.k8s.io/v1beta1: the server is currently unable to handle the request`.

AdvancedTroubleshootingControl plane, RBAC, webhooks and autoscaling
Answer

Likely causes → An aggregated APIService is unavailable (metrics-server or prometheus-adapter uninstalled or broken). The namespace controller must enumerate every API group to delete all contents, and it refuses to finish while discovery fails.

Diagnose →

kubectl get ns old-team -o jsonpath='{.status.conditions}' | jq
kubectl get apiservices | grep -v True

Fix → Repair the backend of the failing APIService, or delete the stale APIService if the component was removed on purpose:

kubectl delete apiservice v1beta1.metrics.k8s.io

The namespace then finishes deleting on its own. Do not strip the namespace finalizer by hand; that leaves orphaned objects in etcd.

Prevent → Uninstall aggregated API components cleanly (remove the APIService too) and alert on unavailable APIServices.

All Kubernetes questions Roadmap: Kubernetes networking, storage & scaling

More on Control plane, RBAC, webhooks and autoscaling