📷 "17° Server Room @ Work" by Leonardo Rizzi is licensed under CC BY-SA 2.0. To view a copy of this license, visit https://creativecommons.org/licenses/by-sa/2.0/.
Policy-as-Code for Kubernetes 2026: Kyverno After CNCF Graduation Compared with OPA Gatekeeper
Policy-as-Code for Kubernetes 2026: Kyverno after CNCF Graduation Compared with OPA Gatekeeper
Since the NIS2 directive at the latest, it is no longer sufficient to describe security policies in a Confluence document. Auditors increasingly ask for the mechanism that enforces rules. This is exactly where Policy-as-Code comes in: instead of managing policies in PDFs, they are integrated as executable rules directly into the Kubernetes admission controller. Two projects dominate this area: Kyverno and OPA Gatekeeper. In March 2026, Kyverno became the latest to reach CNCF graduated status – a good opportunity to compare the two approaches.
Why Policy-as-Code? The Compliance Pressure Is Growing
Anyone operating three or more Kubernetes clusters on different clouds (EKS, AKS, GKE) knows the problem: each cloud provider has slightly different defaults for Pod Security Standards. Sometimes runAsNonRoot is preset differently, sometimes the behavior of service account tokens. Harmless on their own, over time a compliance profile emerges that no one has fully documented any longer.
Policy-as-Code shifts rule definition to where Kubernetes already checks every resource: the Admission Controller. Every kubectl apply call passes through a pipeline from authentication to mutating to validating admission webhooks. This is where Kyverno and OPA Gatekeeper step in and make compliance part of the build process – not just a topic for the next quarterly meeting.
Kyverno: Kubernetes-Native Policies in YAML
Kyverno (Greek for “to govern”) was developed by Nirmata and contributed to the CNCF in 2020. In March 2026, the CNCF announced its graduation at KubeCon Europe in Amsterdam – the highest maturity level after a successful security audit and formal governance review. The project grew from 574 to over 9,000 GitHub stars and is used in production by Bloomberg, Coinbase, Deutsche Telekom, LinkedIn, Spotify, Vodafone, and Wayfair, among others.
The decisive advantage of Kyverno: policies are written in native Kubernetes YAML. Anyone who can formulate a Pod specification can also write a Kyverno policy. The learning curve is flat. Kyverno supports three policy types:
- Validate: Checks whether a resource complies with the rules and blocks it on violations.
- Mutate: Automatically modifies incoming resources – for example, adding labels or injecting a sidecar container.
- Generate: Creates new resources on certain events, such as automatic NetworkPolicies when new namespaces are created.
Kyverno has also fully adopted the Common Expression Language (CEL), which is establishing itself as the standard for admission rules in Kubernetes itself.
OPA Gatekeeper: The Universal Policy Engine
OPA (Open Policy Agent) Gatekeeper is the established counterpart. Instead of YAML, it uses Rego, a purpose-built declarative query language. Rego is extremely powerful, but the learning curve is steep. Debugging a policy in Rego requires a fundamental shift in thinking: you write assertions, not procedures.
The major advantage of OPA: it is not limited to Kubernetes. The same Rego code can check Terraform plans, CI/CD pipelines, API gateway traffic, and IAM policies. So if you need a unified policy language across the entire stack in a large enterprise, OPA is the right choice.
Kyverno vs. OPA Gatekeeper: The Decision Matrix
| Criterion | Kyverno | OPA Gatekeeper |
|---|---|---|
| Language | Kubernetes YAML | Rego (custom DSL) |
| Learning Curve | Low (YAML knowledge suffices) | Steep |
| Scope | Kubernetes only | Universal (K8s, CI/CD, Cloud, Terraform) |
| Mutation | Native, simple YAML patches | Complex, requires advanced Rego |
| CNCF Status | Graduated (March 2026) | Graduated |
| IDEAL FOR | Pragmatic K8s platform teams | Large enterprises with unified policy |
What Platform Teams Should Really Decide in 2026
Three questions help with the choice:
1. Is there a policy need outside Kubernetes? If Terraform plans, IAM policies, or CI pipelines already need to be checked, OPA is the natural choice. If the compliance world is limited to Kubernetes, Kyverno brings less complexity.
2. How large and experienced is the team? In a team where only one person can confidently write Rego, policy maintenance becomes a bottleneck as soon as that person is on vacation or leaves the team. Kyverno YAML survives personnel changes much better.
3. Which security tools are already in use? If Falco, Trivy, or Pod Security Standards are established, reporting requirements can often be met out of the box with Kyverno’s native PolicyReport CRDs.
Conclusion
Policy-as-Code is no longer a nice-to-have in 2026, but an operational necessity – not least due to regulatory requirements such as NIS2. Kyverno’s CNCF graduation in March 2026 underscores that the YAML-based approach has arrived in practice. For the majority of platform teams looking to secure and standardize Kubernetes, Kyverno is the more pragmatic entry point. OPA Gatekeeper remains the first choice when a unified policy language across the entire technology stack is required. Both projects are CNCF-graduated and production-proven – the choice ultimately depends on team structure and scope.
Sources
- CNCF Announces Kyverno’s Graduation (CNCF, March 2026)
- CNCF Announces Kyverno Graduation as Policy-as-Code Adoption Grows (Cloud Native Now, March 2026)
- Kyverno vs OPA Gatekeeper: Kubernetes Policies in 2026 (BriefStack, 2026)
- Kubernetes Governance in Multi-Cloud Environments: Policy-as-Code with OPA and Kyverno (Cloudmagazin, May 2026)
- Kyverno: Kubernetes Policy as Native YAML in 2026 (TokRepo, 2026)
🌐 Machine-translated from the German original, editorially reviewed. 🤖 Written with AI assistance.