Interview Prep/Real-World Interview/Kubernetes cluster-level

You deleted a namespace an hour ago and it's still `Terminating`.

IntermediateTroubleshootingKubernetes cluster-level
Answer

Likely causes → Some object inside still has a finalizer whose controller is gone (for example a custom resource from an uninstalled operator), or the namespace controller can't list a resource type because an APIService is unavailable (often v1beta1.metrics.k8s.io when metrics-server is down).

Diagnose →

kubectl get ns old-team -o jsonpath='{.status.conditions}' | jq
kubectl get apiservice | grep False
kubectl api-resources --verbs=list --namespaced -o name | xargs -n1 kubectl get -n old-team --ignore-not-found --show-kind

Fix → Fix the broken APIService (repair metrics-server or delete the stale APIService). For orphaned custom resources, reinstall the operator so it can clean up, or remove the finalizer from each stuck object:

kubectl patch mycrd/thing -n old-team --type=merge -p '{"metadata":{"finalizers":null}}'

Removing finalizers skips cleanup of external resources (load balancers, cloud volumes), so check those manually.

Prevent → Delete custom resources before uninstalling their operators, and alert on unavailable APIServices.

All Real-World Interview questions Roadmap: Interview readiness

More on Kubernetes cluster-level