Kubernetes ValidatingAdmissionWebhook is an admission control mechanism that accepts or rejects Kubernetes API requests before the API server stores the object in etcd. In practical terms, it lets platform and security teams enforce rules such as “pods must not run privileged,” “images must come from approved registries,” or “production namespaces require owner labels.”
A ValidatingAdmissionWebhook checks Kubernetes API requests after authentication, authorization, and mutation have already happened. It cannot change the object. It can only allow the request, deny it, return a warning, or attach audit information.
You can use it to validate requests for built-in resources such as Pods, Deployments, Services, and Ingresses, as well as custom resources from CRDs.
AdmissionReview request to the configured webhook endpoint over HTTPS.allowed: true or allowed: false response.The webhook is configured using a cluster-scoped ValidatingWebhookConfiguration object. That configuration tells Kubernetes which operations, API groups, API versions, and resources should be sent to the webhook.
latest.team, cost-center, environment, or owner.kube-system, prod, or platform-owned namespaces.rules: Defines which API operations and resources trigger the webhook, such as CREATE on pods.clientConfig: Points the API server to the webhook service or external URL, including TLS configuration.failurePolicy: Controls what happens if the webhook is unavailable. Fail blocks the request. Ignore lets it continue.namespaceSelector: Limits matching to namespaces with specific labels.objectSelector: Limits matching to objects with specific labels.timeoutSeconds: Sets how long the API server waits for the webhook response.sideEffects: Declares whether the webhook has side effects. Admission webhooks should generally avoid external writes during validation.admissionReviewVersions: Lists supported AdmissionReview API versions, commonly v1.Assume your company requires every production Deployment to include an owner label. A ValidatingAdmissionWebhook can inspect every CREATE and UPDATE request for Deployments in namespaces labeled environment=prod.
If a developer applies this manifest:
apiVersion: apps/v1
kind: Deployment
metadata:
name: payments-api
labels:
app: payments-api
spec:
replicas: 3
The webhook can reject it with a clear message:
Deployment "payments-api" is missing required label "owner"
After the developer adds owner: payments-team, the request is allowed.
A ValidatingAdmissionWebhook makes a decision. It allows or rejects a request.
A MutatingAdmissionWebhook changes the object before it is stored. For example, it can inject a sidecar container, add default labels, or set missing fields.
In the admission flow, mutating webhooks run before validating webhooks. This matters because validation usually sees the final object after defaults and mutations have been applied.
ValidatingAdmissionPolicy is a Kubernetes-native way to validate requests using Common Expression Language, or CEL. It does not require running a separate webhook server.
A ValidatingAdmissionWebhook is more flexible because it can call custom code and external systems. For example, it can check an internal service catalog or verify image metadata from a registry. That flexibility comes with more operational work, including deployment, TLS, availability, monitoring, and upgrades.
kubectl, Helm, GitOps, CI/CD, or controllers.failurePolicy: Fail, an unavailable webhook may stop matching API requests.namespaceSelector and objectSelector to avoid matching system components unless needed.ValidatingAdmissionWebhooks are often part of a broader platform control plane. For example, if your teams manage manifests with Terraform, admission validation can enforce runtime cluster rules after Terraform submits resources to the API server. This complements workflows such as deploying Kubernetes resources using Terraform.
The same pattern applies when platform teams manage cloud infrastructure through Kubernetes APIs. If you use Crossplane to provision cloud resources, a ValidatingAdmissionWebhook can enforce rules on Crossplane custom resources before they create real infrastructure. This is useful in setups like deploying AWS resources using Crossplane on Kubernetes.
Kubernetes ValidatingAdmissionWebhook is a powerful way to enforce cluster policy at API request time. It is best suited for rules that must be applied consistently across tools and teams, especially security, compliance, naming, labeling, and platform contract checks. Use it carefully, because webhook availability and latency directly affect Kubernetes API writes.