GitHub
nirmata/kyverno-zero-trust (opens in a new tab)
Every policy in the eBook, grouped by CISA pillar, with tests.
eBook
Kubernetes trusts by default. Any Pod can reach any other Pod, every Pod gets an API token, and any image can run. This guide removes that implicit trust with policy as code, mapped to NIST SP 800-207 and the CISA Zero Trust Maturity Model.
Security leaders
Chapters 1, 2, 10, 13
The case, the frameworks, the roadmap and the 90-day plan.
Architects
Add chapters 3 and 9
Kyverno as the policy decision point and the reference architecture.
Platform & security engineers
Chapters 3–8, with the repo
Every policy, with tests and an audit-first install profile.
Why Kubernetes needs Zero Trust
Each one has existed since Kubernetes 1.0. Each one maps to a chapter that closes it.
| Default behavior | Risk | Fixed in |
|---|---|---|
| Any Pod can reach any other Pod | An attacker moves laterally from one compromised Pod. | Chapter 4 |
| Every Pod mounts a service account token | A stolen token lets an attacker call the Kubernetes API. | Chapter 5 |
| RBAC allows wildcards and cluster-admin bindings | One over-privileged account controls the cluster. | Chapter 5 |
| The cluster runs any image from any registry | Tampered or vulnerable images run in production. | Chapter 6 |
| Pods can run as root or privileged | A container escape gives access to the node. | Chapter 6 |
| Exceptions to policy never expire | Temporary bypasses become permanent holes. | Chapter 7 |
What's inside
Each chapter gives you a tested Kyverno policy, shows how to check that it works, and names the other components that complete the control.
Segmentation that depends on a human setting a label correctly isn't segmentation. Derive it from a boundary the platform team controls.
workspace and tier.Policies in the repo
generate-default-denygenerate-workspace-network-policygenerate-backend-tier-policyrequire-workspace-labelsadd-workload-labelsprotect-segmentation-labelsgenerate-strict-mtlsAlso needed: a CNI plugin that enforces NetworkPolicy (Cilium or Calico), and a service mesh for mTLS.
Grant access per session instead of standing privileges, and make every grant narrow and time-bound.
Policies in the repo
restrict-wildcard-rbacrestrict-cluster-admin-bindingrestrict-escalation-verbsdisable-token-automountdisallow-default-serviceaccountrestrict-jit-labelsgenerate-jit-rolebindingAlso needed: your identity provider and API server RBAC authenticate and authorize first. Kyverno adds context-aware checks at admission.
A permanent exception is standing trust. Treat it like any other access grant.
kyverno-exceptions.Policies in the repo
govern-policy-exceptionsnode-exporter-host-networknode-exporter-compensating-controlsSet this up first. Teams need a safe way to request exceptions before you enforce anything.
Background scans re-check existing resources, including ones created before a policy existed, and write standard policy reports.
Tools
kubectl get policyreports -APolicy Reporterkyverno testAlso needed: API server audit logs for who did what, and a runtime security tool for what processes do after they start (Chapter 12).
Maturity check
Pick the stage that matches each pillar today. You'll get your next step and the chapter that covers it.
NetworksChapter 4
Flat Pod network.
IdentityChapter 5
Shared admin accounts and standing cluster-admin.
Applications & WorkloadsChapter 6
Any image, any settings.
GovernanceChapter 7
Exceptions by email, and they never expire.
Visibility & AnalyticsChapter 8
No policy data.
Your overall stage
Traditional
Implicit trust everywhere. The audit profile shows you exactly where, without blocking anything.
Your next steps
Why now
Each one worked because trust was implicit somewhere. The eBook maps eight documented incidents to the control that would have stopped or contained them.
March 2025
An admission webhook accepted unauthenticated requests and ran with a service account that could read every Secret. More than 6,500 clusters were found exposed.
Restrict webhook access, scope the service account · Ch 4, 5
Through Nov 2025
The Ray dashboard API has no authentication by default and was exposed to the internet, then used to mine crypto, steal models and spread to other nodes.
Default-deny ingress and egress, tier segmentation · Ch 4
November 2025
Containers with custom mount configurations could redirect writes to host paths and gain root on the node.
Restricted Pod Security Standard · Ch 6
March 2026
A compromised CI credential published a backdoored LLM gateway that harvested cloud and Kubernetes credentials and deployed privileged Pods.
Verify signatures, block privileged Pods, restrict egress · Ch 4–6
Companion repository
The audit profile installs every core policy in Audit mode, so it reports violations without blocking anything.
# 1. Get the policies git clone https://github.com/nirmata/kyverno-zero-trust cd kyverno-zero-trust # 2. Install every core policy in Audit mode kubectl apply -k deploy/audit # 3. Review what would have been blocked kubectl get policyreports -A
Each policy has a README, Kyverno CLI tests and an end-to-end test for a local kind cluster. Browse the repo → (opens in a new tab)
Days 1–30
Days 31–60
kyverno test to CI and start signing images.Days 61–90
From one cluster to a fleet
Nirmata Control Hub authors, delivers and reports on Kyverno policies and exceptions across every cluster and team, so you can track maturity by pillar fleet-wide. Nirmata Enterprise for Kyverno is a hardened, supported build of the same engine, with CVE fixes backported to every supported release.
GitHub
Every policy in the eBook, grouped by CISA pillar, with tests.
Whitepaper
Harden, test, patch and upgrade the engine these policies run on.
Free tool
Run the same policies in your pipeline, before a manifest reaches a cluster.
Mapping Kubernetes controls to NIST and CISA for an audit, moving from Audit to Enforce, or rolling Zero Trust out across a fleet? Talk to the maintainers.