What is Kyverno? Kubernetes policies in YAML and CEL
Learn what Kyverno is, its new CEL-based policy types (ValidatingPolicy, MutatingPolicy, GeneratingPolicy, ImageValidatingPolicy, and DeletingPolicy), the end of the legacy ClusterPolicy, and how it compares with OPA/Gatekeeper and the native ValidatingAdmissionPolicy.
Kubernetes$ kyverno apply policy.yaml --resource pod.yaml▍Every shared cluster reaches the same point: someone ships a Pod without resource limits, someone else uses the latest tag, a third person forgets the cost labels. PR review can’t hold that line forever. Kyverno is a policy engine built only for Kubernetes, where rules are resources in the cluster itself, written in YAML, with no brand-new language to learn from scratch.
What Kyverno is
Kyverno (Greek for “govern”) is an open source Kubernetes-native policy engine, licensed under Apache 2.0. It runs as a dynamic admission controller and also evaluates existing resources in the background. Policies are CRDs, so you manage them with kubectl, Git, and GitOps, like any other manifest.
In the CNCF, Kyverno was accepted in 2020, reached incubating in 2022, and graduated in March 2026. That is its status as of November 2026 (check the project page).
A major change: CEL and the end of ClusterPolicy
If you knew Kyverno a few years ago, ClusterPolicy with validate.pattern and mutate.patchStrategicMerge was the center of everything. That has changed. Kyverno adopted CEL-based policy types (Common Expression Language, the same language used by native Kubernetes policies) in the policies.kyverno.io/v1 group. According to the migration guide, ClusterPolicy, Policy, CleanupPolicy, and the legacy PolicyException were deprecated in v1.19, with removal planned for v1.20. v1.20.0, released in November 2026, lists the removal of the legacy kyverno.io engine in its release notes. If you have old policies, migrate before upgrading.
Policies are still YAML; what changed is that rule logic is now written as CEL expressions inside that YAML.
What problem it solves
- Validation: block or audit non-compliant resources (missing labels, privileged, no limits).
- Mutation: fill in resources with defaults such as labels,
securityContext, or tolerations. - Generation: create resources automatically, such as a NetworkPolicy or a ConfigMap for every new namespace.
- Image verification: require image signatures and attestations, a core piece of the image supply chain.
- Cleanup: delete resources on a schedule, such as old test Pods.
How it works
Policy type (policies.kyverno.io/v1) |
Replaces in the legacy model | What it does |
|---|---|---|
ValidatingPolicy |
validate rules |
Validates resources with CEL expressions (Deny, Audit) |
MutatingPolicy |
mutate rules |
Changes resources with ApplyConfiguration or JSONPatch |
GeneratingPolicy |
generate rules |
Creates or syncs resources from a trigger |
ImageValidatingPolicy |
verifyImages rules |
Verifies signatures and attestations (Cosign, Notary) |
DeletingPolicy |
CleanupPolicy |
Deletes resources on a cron schedule |
Each type also has a Namespaced version (NamespacedValidatingPolicy and so on) that applies only to the namespace where it was created: useful for giving teams autonomy without granting cluster-wide power.
Under the hood, the installation has separate controllers: the admission controller (webhooks), the background controller (generation and mutation of existing resources), the cleanup controller, and the reports controller, which produces PolicyReports with evaluation results.
Hands-on example
Kyverno and the kyverno CLI aren’t installed in the environment where this article was written: the Kyverno commands and manifests follow the official documentation. The native ValidatingAdmissionPolicy further down was tested on a Kubernetes v1.36 cluster.
Installing with Helm (v1.20.0 maps to chart 3.10.0):
helm repo add kyverno https://kyverno.github.io/kyverno/
helm repo update
helm install kyverno kyverno/kyverno --version 3.10.0 -n kyverno --create-namespace
A ValidatingPolicy that requires the environment label on Pods, from the documentation example:
apiVersion: policies.kyverno.io/v1
kind: ValidatingPolicy
metadata:
name: check-labels
spec:
validationActions:
- Deny
matchConstraints:
resourceRules:
- apiGroups: ['']
apiVersions: [v1]
operations: [CREATE, UPDATE]
resources: [pods]
validations:
- message: label 'environment' is required
expression: "'environment' in object.metadata.?labels.orValue([])"
A MutatingPolicy that adds a label to every Pod created:
apiVersion: policies.kyverno.io/v1
kind: MutatingPolicy
metadata:
name: add-labels
spec:
matchConstraints:
resourceRules:
- apiGroups: ['']
apiVersions: ['v1']
operations: ['CREATE']
resources: ['pods']
mutations:
- patchType: ApplyConfiguration
applyConfiguration:
expression: >
Object{
metadata: Object.metadata{
labels: Object.metadata.labels{
team: "platform"
}
}
}
And a DeletingPolicy that, every night, deletes Pods marked as old in test namespaces:
apiVersion: policies.kyverno.io/v1
kind: DeletingPolicy
metadata:
name: cleanup-old-test-pods
spec:
schedule: '0 1 * * *'
matchConstraints:
resourceRules:
- apiGroups: ['']
apiVersions: ['v1']
operations: ['*']
resources: ['pods']
scope: 'Namespaced'
namespaceSelector:
matchLabels:
environment: test
conditions:
- name: isOld
expression: "has(object.metadata.labels.old) && object.metadata.labels.old == 'true'"
For ImageValidatingPolicy, the documentation shows key-based and keyless Cosign examples; the conceptual companion is signing images with Cosign, SBOM, and SLSA.
In CI, test policies with the CLI before applying them:
kyverno apply policy.yaml --resource pod.yaml
kyverno test .
The native alternative: ValidatingAdmissionPolicy
Since v1.30, Kubernetes has had a stable ValidatingAdmissionPolicy (VAP): CEL validation run by the API server itself, with no webhook. The same rule, applied only to namespaces labeled policy: enforced:
apiVersion: admissionregistration.k8s.io/v1
kind: ValidatingAdmissionPolicy
metadata:
name: require-environment-label
spec:
failurePolicy: Fail
matchConstraints:
resourceRules:
- apiGroups: [""]
apiVersions: ["v1"]
operations: ["CREATE", "UPDATE"]
resources: ["pods"]
validations:
- expression: "has(object.metadata.labels) && 'environment' in object.metadata.labels"
message: "the 'environment' label is required"
---
apiVersion: admissionregistration.k8s.io/v1
kind: ValidatingAdmissionPolicyBinding
metadata:
name: require-environment-label
spec:
policyName: require-environment-label
validationActions: [Deny]
matchResources:
namespaceSelector:
matchLabels:
policy: enforced
We tested this pair on a v1.36 cluster: a Pod without the label was rejected with the message above, and a Pod with environment went through. Kyverno plays well with this: a ValidatingPolicy can, through autogen, generate the equivalent VAP and let the API server do the work.
When to use it (and when not to)
Use Kyverno when you want to cover validation, mutation, generation, image verification, and cleanup with a single tool, when you need reports (PolicyReport) and per-namespace exceptions, or when the team doesn’t want to maintain Rego.
Don’t use it (or not on its own) when:
- you only need a few simple validations: the native VAP does the job without installing anything;
- the same policies must apply outside Kubernetes (Terraform, APIs): OPA covers more layers;
- you still depend on legacy
ClusterPolicyand have no time to migrate: don’t upgrade to v1.20 without that plan.
Comparison: Kyverno, OPA/Gatekeeper, and VAP
| Criterion | Kyverno | OPA/Gatekeeper | ValidatingAdmissionPolicy |
|---|---|---|---|
| Language | YAML + CEL | Rego (CEL optional in Gatekeeper) | CEL |
| Installation | Controllers + webhooks | Webhook + audit | Built into the API server |
| Validation | Yes | Yes | Yes |
| Mutation | Yes (MutatingPolicy) |
Yes (Gatekeeper mutation resources) | Via MutatingAdmissionPolicy, separately |
| Resource generation | Yes (GeneratingPolicy) |
No | No |
| Image verification | Yes (ImageValidatingPolicy) |
Only with external integrations | No |
| Scheduled cleanup | Yes (DeletingPolicy) |
No | No |
| Outside Kubernetes | Limited | Yes (Conftest, Envoy, APIs) | No |
| CNCF (Nov 2026) | Graduated | Graduated (as part of OPA) | Part of Kubernetes |
To see where admission control fits in the rest of your cluster defenses, read Kubernetes cluster hardening.
Summary
- Kyverno is a Kubernetes-native policy engine, graduated in the CNCF in 2026
- The current types are
ValidatingPolicy,MutatingPolicy,GeneratingPolicy,ImageValidatingPolicy, andDeletingPolicy -
ClusterPolicy,Policy, andCleanupPolicywere deprecated in v1.19 and are removed in v1.20: migrate before upgrading - Use the Namespaced variants to give teams autonomy
- Test policies in CI with
kyverno applyandkyverno test - For simple validations, consider the native ValidatingAdmissionPolicy
- Start in Audit mode and only then switch to Deny
A good policy engine doesn’t replace talking to your teams: it records what was agreed and enforces it on its own.