Kubernetes ValidatingAdmissionPolicy - CEL rules that reject bad objects without a webhook
Answer: Create a ValidatingAdmissionPolicy with CEL expressions in spec.validations, plus a ValidatingAdmissionPolicyBinding that enables it. Validating admission policies offer a declarative, in-process alternative to validating admission webhooks, stable since v1.30.
Example
apiVersion: admissionregistration.k8s.io/v1
kind: ValidatingAdmissionPolicy
metadata:
name: "demo-policy.example.com"
spec:
failurePolicy: Fail
matchConstraints:
resourceRules:
- apiGroups: ["apps"]
apiVersions: ["v1"]
operations: ["CREATE", "UPDATE"]
resources: ["deployments"]
validations:
- expression: "object.spec.replicas <= 5"
message: "replicas must be 5 or fewer"
---
apiVersion: admissionregistration.k8s.io/v1
kind: ValidatingAdmissionPolicyBinding
metadata:
name: "demo-binding-test.example.com"
spec:
policyName: "demo-policy.example.com"
validationActions: [Deny]
matchResources:
namespaceSelector:
matchLabels:
environment: test
The three resources
ValidatingAdmissionPolicydescribes the abstract logic of a policy.- A parameter resource, such as a ConfigMap or CRD, makes it a concrete statement. If a policy does not need parameters, leave
paramKindnot specified. ValidatingAdmissionPolicyBindinglinks them and provides scoping. A policy has no effect without at least one binding.
Actions and failures
| Field | Values | |---|---| | validationActions | Deny rejects the request, Warn returns a warning to the client, Audit adds it to the audit event | | failurePolicy | Fail rejects the request on a policy error; Ignore lets it continue |
To both warn clients and audit failures, use validationActions: [Warn, Audit].
Expressions
- CEL expressions can read
object,oldObject,request,paramsandnamespaceObject. messageExpressionbuilds the denial message and must evaluate to a string.matchConditionsare CEL filters; all must be true for the resource to be evaluated.
Caution
Validating Admission Policy is part of the cluster control plane, so write and deploy policies with great caution. Names ending in .static.k8s.io are reserved for manifest-based admission control.
See also
Claims
- id: C1 claim: A policy needs a binding to have an effect. source: S2 evidence: "must be defined for a policy to have an effect."
- id: C2 claim: Policies use CEL for validation rules. source: S2 evidence: "use the Common Expression Language (CEL) to declare the validation rules of a policy."
- id: C3 claim: Ignore lets the API request continue on policy errors. source: S1 evidence: "the API request is allowed to continue."
Sources
- [S1] Validating Admission Policy. Kubernetes docs. https://kubernetes.io/docs/reference/access-authn-authz/validating-admission-policy/ . License: CC-BY-4.0. Accessed 2026-11-18.
- [S2] validating-admission-policy.md (source page). kubernetes/website (GitHub). https://github.com/kubernetes/website/blob/main/content/en/docs/reference/access-authn-authz/validating-admission-policy.md . License: CC-BY-4.0. Accessed 2026-11-18.
License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: Kubernetes docs, Validating Admission Policy; kubernetes/website (GitHub), validating-admission-policy.md (source page). CC-BY-4.0 (https://raw.githubusercontent.com/kubernetes/website/main/LICENSE). Copyright The Kubernetes Authors. Text was condensed and changed from the originals.
License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: Kubernetes docs, Validating Admission Policy; kubernetes/website (GitHub), validating-admission-policy.md (source page). CC-BY-4.0 (https://raw.githubusercontent.com/kubernetes/website/main/LICENSE). Copyright The Kubernetes Authors.
Cite this
iinventedlight. 2026. "Kubernetes ValidatingAdmissionPolicy - CEL rules that reject bad objects without a webhook." iinventedlight Library, iil:note:8ws5gz0t, version of 2026-11-18. https://iinventedlight.com/library/notes/kubernetes-validating-admission-policy/. License: CC-BY-4.0.
@misc{iil_note_8ws5gz0t,
author = {{iinventedlight}},
title = {{Kubernetes ValidatingAdmissionPolicy - CEL rules that reject bad objects without a webhook}},
howpublished = {iinventedlight Library},
year = {2026},
date = {2026-11-18},
url = {https://iinventedlight.com/library/notes/kubernetes-validating-admission-policy/},
note = {Permanent ID iil:note:8ws5gz0t. License: CC-BY-4.0.},
}
Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).
Extra files beside this note
These files use this note's license, shown below. Paper extras retain their reproduction status; a link is not a reproduction.
- kubernetes-validating-admission-policy.table.json (table; CC-BY-4.0)
- kubernetes-validating-admission-policy.schema.json (schema; CC-BY-4.0)
For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/kubernetes-validating-admission-policy.md.