Welcome to IT Drills
Read little, type a lot. This book teaches you two tools that belong together in every serious Kubernetes cluster: NetworkPolicies control who may talk to whom. Kyverno controls what may enter the cluster in the first place. Everything runs in kind on your laptop, with a small demo application that you will meet again in every chapter.
The training rules
- Type, don’t copy. Every command once yourself.
- Compare with Expected. After every drill you see what you should get. If it differs, that is where the real lesson is.
- Test first, then believe. A NetworkPolicy is only
correct once
conncheck.shconfirms it. A Kyverno policy only once it actually rejects a bad Pod. - Pass the checkpoint. Only when the check script shows nothing but ✔ do you move on.
- Solve the challenge on your own. First the hint, then the solution.
- Lab values stay in the lab. Never use passwords
like
lab-cosign-pwor the cosign keys from Day 10 in production.
Structure of each training day
| Section | Purpose |
|---|---|
| Briefing | The essentials in a few bullet points |
| Drills | Commands with expected output |
| Checkpoint | Check script: did everything work? |
| Challenge | A task without instructions |
| Enterprise Note | What is different in production |
The training plan
| Part | Day | Unit |
|---|---|---|
| Ground | 0 | Training ground: tools, kind, demo app, conncheck.sh |
| A – NetworkPolicies | 1 | Basics: default deny, selectors, ingress/egress |
| 2 | DNS, egress and pitfalls | |
| 3 | Tenants and patterns | |
| B – Cilium and tools | 4 | Cilium: L7, toFQDNs, entities, Hubble |
| 5 | Cluster-wide rules: AdminNetworkPolicy and co. | |
| 6 | Testing and visualizing policies | |
| C – Kyverno | 7 | Basics: installation, Audit vs. Enforce, first ValidatingPolicy |
| 8 | Validate: Pod Security, labels, resources, registries | |
| 9 | Mutate and generate: default deny per namespace | |
| 10 | verifyImages: cosign, attestations, digests | |
| D – Operations | 11 | Testing policies: kyverno test, Chainsaw, CI |
| 12 | Operations: HA, failurePolicy, metrics, upgrades | |
| 13 | Putting it together: onboarding, GitOps, PSA vs. Kyverno | |
| 14 | Competition: disaster drills | |
| Appendix | A | Cheat Sheet |
| B | Final Exam |
The training ground
Part A: kind "np-lab" (kindnet) Part B: kind "cilium-lab" (Cilium, Hubble)
┌─────────────────────────────────────┐ Part C/D: kind "kyverno-lab" (Kyverno)
│ ns shop │
│ frontend ──► api ──► db │ ns default
│ :8080 :8080 :5432 │ client (curl) ── conncheck.sh ──┐
│ :9113 (metrics) │ │
├──────────────────┬──────────────────┤ ns monitoring │
│ ns tenant-a │ ns tenant-b │ scraper ── /metrics every 10 s │
│ api │ api │ │
└──────────────────┴──────────────────┘ ◄──────── ✔ allowed / ✘ blocked ┘
All three clusters get the same demo application from
~/guard-lab/code/demo/. Part A shows what the Kubernetes
standard can do. Part B shows what Cilium can do beyond that. Parts C
and D make sure nobody gets around the rules.
Tip: Tested with kind 0.33 (Kubernetes 1.37), kubectl 1.37, Helm 4.3 and the Kyverno CLI 1.19. If a flag differs:
<befehl> --helpand the official docs.
The companion code
All files from this book are publicly available on GitHub: https://github.com/thomaszachmann/kyverno-networkpolicies-zum-anfassen. Day 0 shows you how to fetch them.
Let’s go.
Thomas Zachmann, October 2026