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.
More on Control plane, RBAC, webhooks and autoscaling
A developer gets `Error from server (Forbidden): pods is forbidden: User "[email protected]" cannot list resource "pods" in API group "" in the namespace "payments"`.BeginnerA CI pipeline fails with `deployments.apps "api" is forbidden: User "system:serviceaccount:ci:deployer" cannot patch resource "deployments" in API group "apps" in the namespace "prod"`.BeginnerA user can `get pods` but `kubectl logs` fails with `cannot get resource "pods/log"` and `kubectl exec` fails with `cannot create resource "pods/exec"`.BeginnerCreating a RoleBinding fails with `is attempting to grant RBAC permissions not currently held`.IntermediateEvery `kubectl apply` fails with `Internal error occurred: failed calling webhook "validate.kyverno.svc-fail": failed to call webhook: Post "https://kyverno-svc.kyverno.svc:443/validate/fail?timeout=10s": context deadline exceeded`.AdvancedCreating a Certificate fails with `failed calling webhook "webhook.cert-manager.io": ... no endpoints available for service "cert-manager-webhook"`.Intermediate