Kyverno: Policy as Code for Automated Compliance Checks
TL;DR Kyverno is a Kubernetes-native policy engine that allows you to define security and …
Diese Serie erklärt systematisch, wie moderne Software compliant entwickelt und betrieben wird – von EU-Regulierungen bis zur technischen Umsetzung.
Cloud-native architectures bring enormous flexibility – and drastically increased complexity. Containers, microservices, Infrastructure as Code, and dynamic orchestration with Kubernetes make traditional, manual security checks practically impossible.
At the same time, European regulations are tightening the focus on measurable security:
Deterministic in this context means: A deployment is either compliant – or it does not occur. Decisions are not made “on the fly” but are automated based on clearly defined rules, data, and thresholds.
Automation is not an end in itself but the only realistic way to achieve consistent, verifiable security standards in complex platforms.
Three components complement each other to form a comprehensive security and compliance model for cloud-native platforms:
Each of these pillars solves a different problem:
Together, they enable security rules to be integrated into the software delivery pipeline – not at the end, but from the beginning.
In Kubernetes environments, admission control decides whether a new object (e.g., a deployment) is accepted. Policy as Code uses this mechanism to define security and compliance requirements as machine-readable rules.
Kyverno is a policy engine specifically developed for Kubernetes. Instead of cryptic, generic rule languages, Kyverno works directly on Kubernetes resources. This simplifies governance in teams already familiar with Kubernetes objects.
Typical guardrails that can be deterministically enforced with Kyverno:
latest tags: Only clearly versioned images may be deployed. This is a prerequisite for reproducible deployments, rollbacks, and traceable release processes.The operating mode is important:
For deterministic checks, you primarily need enforce policies – with clear governance on when a policy can be “blocking” and how exceptions (e.g., temporary waivers) are documented.
This way, you can technically anchor central requirements from NIS-2, DORA, and general compliance frameworks (e.g., ISO 27001): The rule set is no longer managed in PDFs but runs as part of your platform.
Policy as Code answers the question: “Can this configuration be deployed?”
CVE scanning complements this view with: “Is this artifact – image, package, container – free from known vulnerabilities in an acceptable risk class?”
Tools like Trivy analyze container images, operating system packages, and language-specific dependencies (e.g., npm, Maven, Go Modules) against databases of publicly known vulnerabilities (CVE, NVD, distribution advisories).
A typical setup consists of two levels:
CI Pipeline Scanning
Registry Scanning
This creates a continuous security check throughout the lifecycle of an image. Advanced setups use CVE data not just for information but as hard barriers:
This is a central component to measurably meet supply chain security requirements from NIS-2 and the Cyber Resilience Act.
A Software Bill of Materials (SBOM) is a complete, structured inventory of all components, libraries, and dependencies within a product or service – including versions and origins.
Standards like SPDX or CycloneDX allow SBOMs to be created and processed in a machine-readable format.
Why is this so important?
With a comprehensive SBOM strategy, further requirements can also be addressed:
Practically, this means:
Only with automation does SBOM become a strategic tool for security and compliance rather than a “documentation burden.”
The true strength unfolds in the interaction of the three pillars:
Build Time (CI)
Registry Level
Deployment Time (CD / Kubernetes)
Operational Phase (Runtime)
This creates a comprehensive security net that automatically overlays your platform – and at the same time provides a robust data basis for audits within the framework of compliance, NIS-2, DORA, and Cyber Resilience Act.
A concrete, practical process might look like this:
New Image is Built
Your team builds a new version of a service image. In the CI pipeline, an SBOM is automatically generated, and the image is scanned with Trivy.
CVE is Discovered
The scanner finds a critical vulnerability (e.g., a remote code execution in the used framework). The result is documented in the CI system and stored as metadata on the image in Harbor.
Still a Release Candidate
Exceptionally, the image – perhaps due to time pressure or lack of alternatives – is initially marked as a release candidate. The build is “yellow,” not “green”: The risks are visible, but a documented exception has been granted.
Deployment Attempt
A team attempts to deploy this image into a production or secure environment.
TL;DR Kyverno is a Kubernetes-native policy engine that allows you to define security and …
TL;DR Harbor is an open-source container registry (CNCF Graduated Project) that combines registry …
TL;DR Guardrails are automated guidelines around your deployments: They prevent typical …