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

Every `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`.

AdvancedTroubleshootingControl plane, RBAC, webhooks and autoscaling
Answer

Likely causes → The webhook backend is down or unreachable and the webhook has failurePolicy: Fail, so the API server rejects requests it cannot validate. Causes: webhook Pods crashed or were evicted, NetworkPolicy blocks the API server, or on private clusters the control plane cannot reach the webhook port on nodes.

Diagnose →

kubectl get validatingwebhookconfigurations
kubectl get pods -n kyverno
kubectl get endpointslices -n kyverno -l kubernetes.io/service-name=kyverno-svc
kubectl get validatingwebhookconfiguration kyverno-resource-validating-webhook-cfg -o yaml | yq '.webhooks[] | {name, failurePolicy, timeoutSeconds, namespaceSelector}'

Fix → Restore the webhook Pods. If they cannot start because their own Pods are blocked by the webhook (deadlock), temporarily delete the webhook configuration or set failurePolicy: Ignore, recover, then reapply.

Prevent → Run webhooks with 3 replicas, PDBs and high PriorityClass; exclude kube-system and the webhook's own namespace with namespaceSelector; keep timeoutSeconds low (5s).

All Kubernetes questions Roadmap: Kubernetes networking, storage & scaling

More on Control plane, RBAC, webhooks and autoscaling