Protect · Admission policy
Kyverno
Kyverno enforces policies as Kubernetes resources — no new language. It validates and mutates resources at admission, generates defaults like NetworkPolicies, and verifies image signatures and attestations.
On this page
What it does
Runs as an admission controller and background scanner. Since Kyverno 1.19 the stable policy types are
ValidatingPolicy, MutatingPolicy, GeneratingPolicy and ImageValidatingPolicy (policies.kyverno.io/v1),
written in CEL as supersets of the Kubernetes ValidatingAdmissionPolicy and MutatingAdmissionPolicy types. The
older ClusterPolicy/Policy kinds still work but print a deprecation warning. PolicyReport objects record pass
and fail per resource, which is how an Audit policy is evaluated before it is switched to Deny.
Where it fits
Protect stage: the enforcement point for Pod Security, registry allowlists, required labels/limits and image signature verification.
Quick start
helm repo add kyverno https://kyverno.github.io/kyverno/
helm install kyverno kyverno/kyverno -n kyverno --create-namespace
kubectl apply -f https://raw.githubusercontent.com/kyverno/policies/main/pod-security/restricted/disallow-privilege-escalation/disallow-privilege-escalation.yaml
kubectl get vpol,mpol,gpol # the CEL policy types
kubectl get policyreport -A
Common pitfalls
- Enforcing cluster-wide on day one breaks system namespaces; start in
Audit, excludekube-system. - Webhook failure policy set to
Ignoresilently disables enforcement when Kyverno is down; understand the trade-off. - A
MutatingPolicywritten againstObject.spec…is auto-generated for Deployments and fails there with a type error; setspec.autogen.podControllers.controllers: []or write it againstspec.template. - Only the first denying policy’s message reaches the client (one fine-grained webhook per policy); the reports show all of them.
On this site
- Platform Guardrails with Kyverno and GitOps: baseline and production
ValidatingPolicylayers keyed on namespace labels, delivered by Argo CD, rolled out audit-first, with scopedPolicyExceptionobjects that expire.
Hands-on labs using Kyverno
Enforce Pod Security with Pod Security Admission and Kyverno
On a kind cluster, turn on the restricted Pod Security profile for a namespace, watch it reject a default pod, then add a Kyverno ValidatingPolicy in Audit mode, read the PolicyReport, and switch it to Deny.
Articles about Kyverno
Platform Engineering Foundations: Defining the Platform Contract
The operating model behind the CI templates, ApplicationSets, Kyverno guardrails and observability stack on this site: what a team hands over, what the platform returns, where the golden path ends and enforcement begins.
Platform Guardrails with Kyverno and GitOps
Kyverno as a platform guardrail system: baseline and production policy layers keyed on namespace labels, delivered by Argo CD from one repository, rolled out audit-first, with scoped expiring exceptions.
Kyverno Policies for Kubernetes Security: Validate, Mutate, Generate
Install Kyverno 1.19, write CEL-based ValidatingPolicy, MutatingPolicy and GeneratingPolicy resources for non-root pods, image tags, allowed registries and default-deny networking, and roll them out audit-first.
Kubernetes Security Checklist for Production Clusters
A layered checklist — control plane, workloads, network, secrets, supply chain and runtime — with the manifests and commands to verify each control rather than just tick it.