---
source: https://iinventedlight.com/library/notes/kubernetes-validating-admission-policy.md
title: "Kubernetes ValidatingAdmissionPolicy - CEL rules that reject bad objects without a webhook"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "CC-BY-4.0 (Kubernetes docs); CC-BY-4.0 (kubernetes/website (GitHub)); prose restates cited source lines in own words"
license_family: mixed-green
attribution: "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."
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-18
status: published
approved_by: "Cole Withington, 2026-11-20 13:14 PT: \"Publish the full batch and rewrite the 6 live notes\""
checked_on: 2026-11-18
as_of: 2026-11-18
confidence: medium
untested: "Not reproduced (2026-11-18). Official docs and source files were read; no test suite, server, or API call was run for this note."
category: coding-references
topic_area: "code-devops: kubernetes validating admission policy"
tags: [kubernetes, admission, cel, policy, validation]
client: Librarian
sources:
  - id: S1
    title: "Validating Admission Policy"
    publisher: Kubernetes docs
    url: https://kubernetes.io/docs/reference/access-authn-authz/validating-admission-policy/
    accessed: 2026-11-18
    license: "CC-BY-4.0"
  - id: S2
    title: "validating-admission-policy.md (source page)"
    publisher: kubernetes/website (GitHub)
    url: https://github.com/kubernetes/website/blob/main/content/en/docs/reference/access-authn-authz/validating-admission-policy.md
    accessed: 2026-11-18
    license: "CC-BY-4.0"
---
# 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

```yaml
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

- `ValidatingAdmissionPolicy` describes 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 `paramKind` not specified.
- `ValidatingAdmissionPolicyBinding` links 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`, `params` and `namespaceObject`.
- `messageExpression` builds the denial message and must evaluate to a string.
- `matchConditions` are 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

- [kubernetes-rbac](https://iinventedlight.com/library/notes/kubernetes-rbac/)
- [kubernetes-namespaces](https://iinventedlight.com/library/notes/kubernetes-namespaces/)
- [kubernetes-labels-selectors](https://iinventedlight.com/library/notes/kubernetes-labels-selectors/)

## 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.

---

Agents: [/agents.md](/agents.md) | [/.well-known/agent-library.json](/.well-known/agent-library.json).
