Foreword
Read little, type a lot. A development team wants to run a small API with a database. That takes a Deployment, a Service, a Secret, a StatefulSet, a volume, a NetworkPolicy and, ideally, checks that report when something is stuck. That is seven objects with more than 200 lines of YAML between them. The team wants nothing to do with any of it and would rather just say: “I’d like a Notes app with two replicas.”
That is exactly what you build in this book. kro
(Kube Resource Orchestrator) is a controller for Kubernetes. In it you
describe your own API, such as NotesApp, and define which
objects are created for each instance and how their values relate to
each other. From that, kro generates a CRD, checks every expression as
soon as you create it, and then keeps all objects alive in the right
order. You need no Go code, no operator project of your own and no
templates for this.
The common thread is notes-api, the small notes API
from the sister books. On Day 4 it gets its own API,
NotesApp. After that it grows day by day: status and
readiness, Postgres with a protected volume, an optional NetworkPolicy,
checks per path, central defaults from the platform, a fleet with
several environments, permissions for teams and, at the end, GitOps.
This book is for platform people, admins and developers who know
Kubernetes and kubectl and want to offer their teams their
own simple APIs.
The Training Rules
- Type, don’t copy. Run every command yourself once.
- Compare with Expected. After every drill you’ll find what you should see. If it differs, that is where the real lesson is.
- First the RGD, then the instance. You check every
change to a ResourceGraphDefinition with
kubectl get rgdbefore you create instances. kro shows most errors right there. - Pass the checkpoint. Only when the check commands show what is written there do you move on.
- Solve the challenge on your own. First the hint, then the solution.
- Lab values stay in the lab.
lab-api-key-123and the otherlab-…values are practice data. Real secrets have no place in this book.
Warning: All output comes from real test runs. Times, IDs, hashes and pod names will differ on your machine. What matters is what happens.
Structure of Each Training Day
| Section | Purpose |
|---|---|
| Briefing | The essentials in a few bullet points |
| Drills | Commands and files with expected output |
| Checkpoint | Individual check commands: did everything work? |
| Challenge | A task without instructions |
| Enterprise Note | What is different in production |
The Training Plan
| Part | Day | Unit |
|---|---|---|
| 1 – Basics | 0 | The training ground |
| 1 | Installing kro, first RGD | |
| 2 | SimpleSchema | |
| 3 | CEL expressions | |
| 2 – The NotesApp | 4 | Several resources, one graph |
| 5 | Status and readiness | |
| 6 | Postgres and the deletion policy | |
| 7 | Conditions with includeWhen | |
| 8 | Collections with forEach | |
| 9 | External references | |
| 10 | RGD chaining: the fleet | |
| 3 – Operations | 11 | Lifecycle and revisions |
| 12 | Permissions, feature gates, metrics | |
| 13 | kro, Helm, Kustomize or operator? | |
| 14 | GitOps, upgrade and outlook | |
| Competition | 15 | Five failures |
| Appendix | A | Cheat sheet |
| B | Final exam |
The Lab
You work over SSH on an Ubuntu 24.04 VM kro with 2 CPUs
and 4 GB RAM. You start it with Multipass, but any other Linux VM with
sudo and internet access will do. k3s, kro and all
instances run on it. Your laptop only needs SSH and
curl.
The tested versions: k3s 1.37.2, Helm 4.3.1, kro 0.10.0, notes-api 0.5.1 and Postgres 18.6.
You’ll find the companion code at
https://github.com/thomaszachmann/kro-zum-anfassen. Day 0
fetches it with git clone. For each day it contains the
finished files in loesung/ and the broken files for the
competition in wettkampf/. You are meant to write the files
yourself. The solutions are there for comparison.
Where this book only touches on an area, the sister books go into depth: “Kubernetes hands-on” for the cluster, “Kubernetes operators hands-on” for your own controllers in Go, “Kyverno & NetworkPolicies hands-on” for policies.
Let’s go.