Infrastructure

Azure AKS: diagnose an admission webhook before bypassing security

A production runbook for isolating an unavailable AKS admission webhook, preserving security controls and validating a bounded recovery or rollback.

26 Nov 2026 azureakskubernetesadmission-webhooksecurityobservabilitydeploymentrunbookrollbackproduction

An AKS deployment fails to create pods with “failed calling webhook”. Existing pods still serve traffic, but new deployments and some controllers stop progressing. Switching every webhook to Ignore may unblock the API while admitting objects that no longer satisfy the intended policies.

The running case is an internal validating webhook exposed through a Kubernetes Service, configured to Fail, after its controller was upgraded. The goal is to restore admission with evidence, not permanently remove a control. The commands below are read-only, apart from the explicitly identified dry run.

Bound the incident

Pause deployments that are multiplying retries. Record UTC time, cluster and kubectl context, namespace, object kind, operation, exact webhook name, complete error and controller version. Identify recent changes and affected workloads; running pods alone do not prove the cluster is healthy.

An explicit “denied” response is a policy decision, not necessarily a communication failure. A timeout, TLS error, “service not found” or missing endpoints points to a different boundary. Check control-plane health and other API errors too: simultaneous symptoms may extend beyond one webhook.

Inspect the configuration actually called

kubectl config current-context
kubectl get validatingwebhookconfigurations,mutatingwebhookconfigurations
kubectl get validatingwebhookconfiguration <configuration> -o yaml
kubectl -n <webhook-namespace> get svc <service> -o yaml
kubectl -n <webhook-namespace> get endpointslices \
  -l kubernetes.io/service-name=<service> -o yaml
kubectl -n <webhook-namespace> get pods -o wide

For the entry named in the error, record rules, operations, versions, namespaceSelector, objectSelector, any matchConditions, failurePolicy, timeoutSeconds, Service, port, path and caBundle. One configuration can contain several webhooks: do not accidentally change its neighbours. Check the actual namespace and object labels to understand the match. A mutating webhook may also be involved before validation.

EndpointSlices should contain ready backends and agree with the Service selector and port. Inspect events, logs and controller replica availability; a Service without a ready endpoint is not evidence of availability. A test from a pod is useful but does not by itself prove the AKS API-server-to-webhook path.

Isolate the failing boundary

  • No ready endpoints: inspect readiness, scheduling, restarts, selectors and image version. Avoid restarting every replica at once.
  • Timeout despite ready endpoints: correlate server logs, load and latency with the failure window; examine the control-plane-to-webhook path and network restrictions relevant to your AKS configuration. A successful pod-originated connection does not validate that path.
  • TLS error: compare the served certificate, validity, expected Service name and configured CA. An incomplete rotation can leave the server and caBundle out of sync. Do not disable TLS verification.
  • Explicit denial: inspect the reason and policy version; compare the request with a known compliant object. Fix the object or propose a reviewed policy change, not a cluster-wide bypass.
  • Failure limited to one operation or version: check matching rules and AdmissionReview version compatibility with the server; healthy pods alone are insufficient.

Events and logs can contain sensitive data. Restrict access and retention. An absent webhook log entry does not by itself prove a network failure: the request may have failed earlier or logging may be incomplete.

Repair without opening the whole cluster

If the incident followed a controller upgrade, compare image, manifest, Service, certificate and webhook configuration with the last known good version. Restore only the affected components using the vendor’s procedure and their declarative owner; avoid a manual change that a reconciler will undo. Check dependencies and compatibility before rolling back.

Temporarily changing Fail to Ignore affects call failures, not explicit denials. It is a security exception, not a fix: require security and service-owner approval, bounded scope and duration, an inventory of objects admitted during the window, an effective compensating control and a restoration procedure. If those conditions cannot be met, keep the block and escalate. Do not delete the entire configuration just to speed up a deployment.

Validate and decide

In a canary namespace covered by the same selectors, submit a representative compliant object with kubectl apply --dry-run=server -f <compliant-object.yaml>. Then test a deliberately non-compliant object and confirm it is denied for the expected reason. Server-side dry run requires compatible side-effect declarations from the relevant webhooks; a dry-run failure does not automatically mean the webhook is down. If needed, follow with a controlled, reversible creation using no real workload or data.

Confirm ready endpoints, webhook logs, latency and absence of API errors; check controller behaviour and the user-facing service as well. Repeat both cases after restoring the security configuration. If an exception was used, remove it, verify the effective configuration and reconcile objects admitted during the window. If the expected denial disappears or the failure returns, stop recovery and return to the known safe state with the responsible team.

Decision: resume deployments progressively only when the compliant object passes, the prohibited object remains blocked and operational evidence is complete. Otherwise, keep changes paused and escalate with the correlated error, configuration and observations.

References