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).
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`.IntermediateCreating a Certificate fails with `failed calling webhook "webhook.cert-manager.io": ... no endpoints available for service "cert-manager-webhook"`.IntermediateA webhook fails with `failed calling webhook ... tls: failed to verify certificate: x509: certificate signed by unknown authority`.Intermediate