Symptoms
- New pods never appear.
kubectl get rsshows desired replicas that never become current. - Events contain errors like:
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... no endpoints available for service "aws-load-balancer-webhook-service"... x509: certificate signed by unknown authority
kubectl applyfor Services, Ingresses or ConfigMaps also fails, depending on which resources the webhook intercepts.- Running pods keep running. The outage grows as pods get rescheduled, autoscaling fires or nodes are replaced.
The API server calls the webhook before it stores the object. If the webhook is unreachable and its failurePolicy is Fail, the request is rejected.
Step 1: find the failing webhook (3 minutes)
kubectl get events -A --field-selector reason=FailedCreate --sort-by=.lastTimestamp | tail -20
kubectl get validatingwebhookconfigurations
kubectl get mutatingwebhookconfigurations
The webhook name in the error (for example validate.kyverno.svc-fail) maps to an entry in one of these configurations. Show its policy and backend:
kubectl get validatingwebhookconfiguration kyverno-resource-validating-webhook-cfg -o json \
| jq '.webhooks[] | {name, failurePolicy, timeoutSeconds, service: .clientConfig.service, namespaceSelector}'
Find the configuration from the webhook name across all of them:
for kind in validatingwebhookconfigurations mutatingwebhookconfigurations; do
kubectl get $kind -o json | jq -r --arg k $kind \
'.items[] | .metadata.name as $cfg | .webhooks[] | "\($k)\t\($cfg)\t\(.name)\t\(.failurePolicy)"'
done | column -t
Step 2: check the webhook backend
NS=kyverno; SVC=kyverno-svc
kubectl get pods -n $NS -o wide
kubectl get endpoints $SVC -n $NS
kubectl describe pods -n $NS | grep -A5 Events
| What you see | Cause | Fix |
|---|---|---|
Endpoints empty, webhook pods Pending | Pods cannot schedule, often because the webhook blocks its own pods or nodes are gone | Step 3, then let the pods start |
Endpoints empty, pods CrashLoopBackOff | Bad upgrade, bad config, missing CRDs | Roll back the Helm release after Step 3 |
Endpoints present, context deadline exceeded | API server cannot reach the pod port | Step 4, security groups or CNI |
x509 or certificate errors | Webhook serving cert expired or caBundle out of date | Restart cert-manager or the controller that injects the CA; check caBundle |
| Errors only on one resource type after an upgrade | New webhook version rejecting objects | Review the controller's release notes; roll back |
Step 3: restore pod creation now
Kubernetes does not send ValidatingWebhookConfiguration and MutatingWebhookConfiguration objects to admission webhooks, so you can always change them even when the webhook is broken.
Back up the configuration first:
kubectl get validatingwebhookconfiguration kyverno-resource-validating-webhook-cfg -o yaml > vwc-backup.yaml
Option A: fail open. Change failurePolicy to Ignore for the failing webhook entry (index 0 here; check the index in Step 1):
kubectl patch validatingwebhookconfiguration kyverno-resource-validating-webhook-cfg --type=json \
-p='[{"op":"replace","path":"/webhooks/0/failurePolicy","value":"Ignore"}]'
Option B: remove the configuration. Faster when it has many entries:
kubectl delete validatingwebhookconfiguration kyverno-resource-validating-webhook-cfg
Caution
If this is a security webhook (Kyverno, Gatekeeper, image signature checks), failing open lets non-compliant pods in. Get approval from the security on-call, record the time window, and re-enable it as soon as the backend is healthy. Audit what was created during the gap.
Warning
Some controllers recreate or reconcile their webhook configurations when their pods start, and Helm puts them back on the next upgrade. Expect the patch to be undone once the controller recovers; that is fine if the backend is healthy.
Watch pods come back:
kubectl get pods -A --field-selector status.phase=Pending | head
kubectl rollout status deployment/orders-api -n orders
Step 4: fix the network path on EKS
On EKS the API server runs in an AWS-managed VPC and reaches webhook pods through ENIs in your subnets. The node or pod security group must allow inbound traffic from the cluster security group on the webhook's target port (often 9443 or 8443, not 443; check the Service targetPort).
CLUSTER=prod-eks
aws eks describe-cluster --name $CLUSTER \
--query "cluster.resourcesVpcConfig.{clusterSG:clusterSecurityGroupId,sgs:securityGroupIds}"
kubectl get svc $SVC -n $NS -o jsonpath='{.spec.ports[*].targetPort}'
aws ec2 describe-security-groups --group-ids sg-nodes \
--query "SecurityGroups[].IpPermissions[].[IpProtocol,FromPort,ToPort,UserIdGroupPairs[].GroupId]" --output table
Add the rule if it is missing:
aws ec2 authorize-security-group-ingress --group-id sg-nodes --protocol tcp --port 9443 \
--source-group sg-cluster
Other EKS-specific causes:
- Custom CNI overlay (for example Calico or Cilium in overlay mode). The control plane cannot route to overlay pod IPs. Run the webhook with
hostNetwork: trueor use the VPC CNI. - Security groups for pods. If the webhook pod has its own security group, that group needs the inbound rule.
- New node group or Karpenter
EC2NodeClasswith different security groups. Webhook pods that land there become unreachable.
Step 5: confirm in the control plane logs
If API server logging is enabled, search the /aws/eks/<cluster>/cluster log group with CloudWatch Logs Insights:
fields @timestamp, @message
| filter @logStream like /kube-apiserver-/
| filter @message like /failed calling webhook/
| stats count(*) by bin(5m)
Errors should drop to zero after Step 3 and stay there after you restore the original failurePolicy.
Step 6: put the guardrail back
Once endpoints are healthy and a test request succeeds:
kubectl apply -f vwc-backup.yaml
kubectl run webhook-test --image=public.ecr.aws/docker/library/busybox:stable --restart=Never -- sleep 30
kubectl delete pod webhook-test
If you deleted the configuration and the controller recreates it, compare the new one with your backup instead of applying the backup over it.
Prevent it next time
- Exclude
kube-systemand the webhook's own namespace with anamespaceSelector, so the webhook can never block its own recovery or core add-ons:
namespaceSelector:
matchExpressions:
- key: kubernetes.io/metadata.name
operator: NotIn
values: ["kube-system", "kyverno"]
- Use
failurePolicy: Ignorefor mutating webhooks that only add defaults; keepFailonly where enforcement must be strict. - Run webhook backends with at least two replicas across AZs, a PodDisruptionBudget and a high
priorityClassName. - Keep
timeoutSecondslow (the default is 10, the maximum 30) so a slow webhook does not stall the API server. - Alarm on webhook errors. The API server exposes metrics such as
apiserver_admission_webhook_rejection_countandapiserver_admission_webhook_admission_duration_seconds; names vary by version, so check your cluster's/metricsoutput. - Add the cluster-security-group rule for each webhook port to your node security group in IaC, not by hand.
Get the weekly HubDatAI email
One email a week with everything new: posts, learning sessions and videos. Free, no spam, unsubscribe in one click. What you get