`Error from server (InternalError): Internal error occurred: failed calling webhook "validation.gatekeeper.sh": ... context deadline exceeded` blocks every deploy
IntermediateTroubleshootingKubernetes admission control and Pod Security
Answer
Likely causes → Gatekeeper pods are down, overloaded, or unreachable from the API server (network policy, private cluster firewall on port 8443), and the webhook is failurePolicy: Fail.
Diagnose →
kubectl -n gatekeeper-system get pods
kubectl -n gatekeeper-system get endpoints gatekeeper-webhook-service
kubectl get validatingwebhookconfiguration gatekeeper-validating-webhook-configuration -o yaml | grep -E "failurePolicy|timeoutSeconds"
Fix → Restore the pods (scale, resources), open API-server-to-webhook traffic (GKE private clusters need a firewall rule for the webhook port).
Prevent → Run 3 replicas with a PDB and anti-affinity, exempt kube-system, set reasonable timeoutSeconds, and alert on webhook latency/rejections.
More on Kubernetes admission control and Pod Security
`Error from server: admission webhook "validate.kyverno.svc-fail" denied the request: policy Deployment/prod/api for resource violation: require-run-as-nonroot`BeginnerPods do not appear, but `kubectl apply` of the Deployment succeededBeginner`pods "api-7d9" is forbidden: violates PodSecurity "restricted:latest": allowPrivilegeEscalation != false, unrestricted capabilities, seccompProfile`BeginnerEnabling `enforce=restricted` on a namespace did not evict the existing non-compliant podsBeginnerKyverno is down and now the whole cluster, including Kyverno's own namespace, cannot be fixed because writes are rejectedAdvancedGatekeeper constraint is created but violations are not blocked; `kubectl get constraint` shows `TOTAL-VIOLATIONS: 12`Intermediate