Skip to the levels
ROOTSPIRE
DiscsFor teachers
▶ Play freeLibrary 16 discsDiscsFor teachersLog in

Every level, in the open

Kubernetes

9 worlds · 90 levels · 9 bosses

SOLUTION HIDDENTeachers see answer keys in the classroom.

▶ Play this discAll discs
All discsLinux: Zero to RootBash ScriptingGitDatabasesPython for OpsLinux Sysadmin ProNetworkingObservabilityCloud & IaCDocker & ContainersCTF ArenaSOC FieldWindows for Linux peopleKubernetesAnsibleThe Guildhall: First Week

Sequel to Docker & Containers: build a tiny orchestrator from real processes, then drive the Kubernetes API with kubectl and real YAML. Honest note: the VM is too small for a cluster, so kubectl talks to KUBESIM, a simulated API server in your VM. Real clusters come in field levels.

Guided levels show the command first. Alone levels give the goal only. Bosses and exams are timed.

Jump to a world

World 1 Fleet YardWorld 2 Health & DiscoveryWorld 3 Pod HarborWorld 4 Deploy DocksWorld 5 Config VaultWorld 6 Service TownWorld 7 Guard TowerWorld 8 Storage & OpsWorld 9 Chart Harbor

World 1Fleet Yard

9 levels

Before kubectl, build a tiny orchestrator out of real processes: a file that says what should run, and a loop that makes it so.

  1. 1

    Level 1: Write it down

    GuidedEasy

    Objective: Write the desired state of the web app to ~/fleet/apps/web.conf: three lines app=web, replicas=3 and image=v1.

    Imperative means giving orders (start a server, start another); declarative means writing down what should be true (3 web servers, version v1) and letting a program make it so, again and again. Kubernetes is declarative: every YAML file is a desired state.

    Commands taughtdesired-state

    ▶ Play: Write it downSOLUTION HIDDEN20 XP
  2. 2

    Level 2: What's really running?

    GuidedEasy

    Objective: Compare ~/fleet/apps/web.conf with what's running, and tell Kern how many more web pods must start: kern NUMBER.

    Actual state is what really runs: Kern's pod tool starts real busybox httpd processes, pod ls lists them (Running, or Exited when the process died) and ps shows the same processes. Dead pods serve nobody.

    Commands taughtfleet-pod

    ▶ Play: What's really running?SOLUTION HIDDEN20 XP
  3. 3

    Level 3: Make it so

    GuidedEasy

    Objective: Fill in the two TODO F3 lines of ~/fleet/reconcile (delete Exited pods, start missing ones), then run it so 3 web pods run.

    A reconcile pass reads the desired state, looks at the actual state and fixes the difference: delete what's dead, start what's missing (Kubernetes' ReplicaSet controller does exactly this). Kern's skeleton ~/fleet/reconcile has TODO lines tagged with the level that fills them.

    Commands taughtreconcile

    ▶ Play: Make it soSOLUTION HIDDEN25 XP
  4. 4

    Level 4: Whose pods are these?

    GuidedEasy

    Objective: web is missing a pod, but reconcile thinks all is fine because it counts db-1 too: fill in TODO F4 (the selector) and run reconcile.

    Pods carry labels (here app and image) and a controller picks its pods with a selector like app=web; without one, reconcile counts every pod in the yard, including the database team's db-1. In Kubernetes every ReplicaSet and Service has a selector: hidden -l app=web.

    Commands taughtlabel-selector

    ▶ Play: Whose pods are these?SOLUTION HIDDEN25 XP
  5. 5

    Level 5: Tools for the loop

    GuidedEasy

    Objective: Type each example once. They are dry runs, so you cannot break the fleet.

    A control loop is shell plus pod. pod ls -q prints only names, -l filters by label, -s by status; [ -z TEXT ] is true when TEXT is empty; break leaves a loop; --loop and exec are how the controller starts itself. These are practice runs: nothing is changed.

    ▶ Play: Tools for the loopSOLUTION HIDDEN20 XP
  6. 6

    Level 6: The control loop

    GuidedEasy

    Objective: Fill in TODO F5 in ~/fleet/controller, start it in the background, then kill a web pod's process and watch the loop replace it.

    Running reconcile by hand fixes things once; a controller runs it forever in the background (while true; do reconcile; sleep 2; done), so a killed pod is replaced on the next pass: self-healing. Kubernetes' kube-controller-manager is a set of these loops.

    Commands taughtcontrol-loop

    ▶ Play: The control loopSOLUTION HIDDEN30 XP
  7. 7

    Level 7: Poke the fleet

    GuidedEasy

    Objective: Start the controller, let the chaos monkey kill one web pod, watch the loop heal it, then try two at once.

    The control loop only proves itself when something breaks. chaos APP N is Kern's chaos monkey: it kills N running pods of APP, like a node losing them. If the loop works, the fleet heals by itself.

    ▶ Play: Poke the fleetSOLUTION HIDDEN25 XP
  8. 8

    Level 8: Night tariff

    AloneMedium

    Objective: Traffic is low tonight: scale web from 5 pods to 2 by changing the desired state, fill in TODO F6 and run reconcile. db-1 must stay untouched.

    Scaling is just a new desired number: up is done (reconcile starts missing pods), down means deleting the extra ones, and only web's, thanks to the selector. hidden changes the same number.

    Commands taughtscaling

    ▶ Play: Night tariffSOLUTION HIDDEN35 XP
  9. 9

    Level 9: Kill-proof

    Boss⏱ TimedHard

    Objective: Scale web to 4, keep db-1 alone, start the control loop, and survive the chaos monkey: the fleet must heal itself.

    Everything at once: change the desired state, run the control loop in the background, then let Kern's chaos monkey kill pods. A good controller heals the fleet with nobody typing.

    ▶ Play: Kill-proofSOLUTION HIDDEN80 XP

World 2Health & Discovery

7 levels

Alive isn't healthy and running isn't ready: health checks, one stable address for the whole fleet, and updates nobody notices.

  1. 10

    Level 10: Alive isn't healthy

    GuidedEasy

    Objective: web-2 runs but its /healthz is gone: fill in TODO H1 of ~/fleet/reconcile (restart pods whose /healthz doesn't answer) and run it.

    A process can run and still be broken (stuck, out of disk), so a liveness probe asks the app itself, here GET /healthz, and restarts it in place when there's no answer. In Kubernetes the kubelet does this (livenessProbe) and the RESTARTS column counts it.

    Commands taughtliveness-probe

    ▶ Play: Alive isn't healthySOLUTION HIDDEN25 XP
  2. 11

    Level 11: Crash loop

    GuidedEasy

    Objective: web-3 runs a broken build and your reconcile restarts it every pass: fill in TODO H2 (backoff) and run reconcile.

    A pod that crashes on start gets restarted again and again, and restarting at once forever floods logs and burns CPU, so Kubernetes waits longer each time (10 s, 20 s, 40 s, up to 5 min): CrashLoopBackOff. Ours waits 2^RESTARTS seconds, at most 60.

    Commands taughtcrashloop-backoff

    ▶ Play: Crash loopSOLUTION HIDDEN30 XP
  3. 12

    Level 12: Not ready yet

    GuidedEasy

    Objective: web-3 is still warming up: fill in TODO H3 so reconcile writes the ready pods to ~/fleet/endpoints/web (NAME 127.0.0.1:PORT), then run it.

    Ready is not alive: a pod warming its cache is healthy but shouldn't get customers yet, so a readiness probe (GET /ready) decides who goes in the endpoints list, the addresses traffic may go to. Not ready means no traffic, not a restart.

    Commands taughtreadiness-probe

    ▶ Play: Not ready yetSOLUTION HIDDEN25 XP
  4. 13

    Level 13: One address

    GuidedEasy

    Objective: Fill in TODO H4 so reconcile writes ~/fleet/svc/web.cfg from head.cfg plus one server line per endpoint and starts haproxy; then curl 127.0.0.1:8080/whoami.

    Pods come and go with new ports, but customers need one address that never moves: a Service, here haproxy on 127.0.0.1:8080 with its server list generated from the endpoints file and reloaded when it changes. Kubernetes does it with a ClusterIP and kube-proxy rules.

    Commands taughtservice-endpointsfleet-customer

    ▶ Play: One addressSOLUTION HIDDEN30 XP
  5. 14

    Level 14: One at a time

    AloneMedium

    Objective: Roll out web v2: set image=v2 in ~/fleet/apps/web.conf, fill in TODO H5, then run reconcile pass after pass until all 3 pods run v2.

    A new version means replacing every pod, never all at once: with maxUnavailable=1 you delete ONE old pod, wait until its replacement is ready, then the next (a not-ready old pod can always go, it serves nobody). Kubernetes Deployments roll out exactly like this.

    Commands taughtrolling-update

    ▶ Play: One at a timeSOLUTION HIDDEN40 XP
  6. 15

    Level 15: Roll it back

    Alone⏱ TimedHard

    Objective: v3 crashes: roll web back to v2 (earlier desired states are in ~/fleet/history) and let the running controller bring all 3 pods back to v2.

    A bad rollout gets stuck: the new pod never gets ready, so maxUnavailable holds the old ones. Rollback = apply the previous desired state again; the broken pod goes first, it serves nobody. kubectl rollout undo does this with the previous ReplicaSet.

    Commands taughtrollout-undo

    ▶ Play: Roll it backSOLUTION HIDDEN45 XP
  7. 16

    Level 16: Zero downtime

    Boss⏱ TimedHard

    Objective: Ship web v4 with zero failed customer requests: run the customer and the control loop, add the drain (TODO H7), then deploy v4.

    A pod about to be deleted must leave the Service first (drain), get a moment to finish its requests, then stop: Kubernetes takes a terminating pod out of the endpoints first. Then ship v4 while a customer keeps clicking: zero failed requests.

    ▶ Play: Zero downtimeSOLUTION HIDDEN100 XP

World 3Pod Harbor

13 levels

First shift at the harbor cluster: meet kubectl, launch pods, write their YAML, read their events and logs, sort them with labels.

  1. 17

    Level 17: kubectl, one verb at a time

    GuidedEasy

    Objective: Type each example once. They are dry runs, so you cannot break the cluster.

    kubectl VERB RESOURCE NAME [flags]. Before you need them, meet the verbs and flags the next worlds use: cluster-info, run, scale, annotate, get -A / --sort-by, create with its flags, auth can-i, explain and exec. These are practice runs: nothing is changed.

    ▶ Play: kubectl, one verb at a timeSOLUTION HIDDEN20 XP
  2. 18

    Level 18: First look

    GuidedEasy

    Objective: Ask the cluster where its control plane runs and which nodes it has, peek at all its pods, then tell Kern the name of the control-plane node: kern NODE.

    A cluster = machines (nodes) run by a control plane: API server, etcd (its database), scheduler, controller manager. kubectl only talks to the API server. SIM: here that is KUBESIM, a simulated API server in your VM.

    Commands taughtkubesimkubectl

    ▶ Play: First lookSOLUTION HIDDEN20 XP
  3. 19

    Level 19: Launch a pod

    GuidedEasy

    Objective: Launch a pod named harbor from the image nginx:1.27 and check that it is Running.

    A Pod is the smallest thing Kubernetes runs: one or more containers sharing an IP and a lifetime. kubectl run NAME --image=IMAGE asks for one; the scheduler picks a node, its kubelet starts it. hidden shows READY and STATUS.

    Commands taughtkubectl-run

    ▶ Play: Launch a podSOLUTION HIDDEN20 XP
  4. 20

    Level 20: Write a Pod, line by line

    GuidedEasy

    Objective: Build dock.yaml one key at a time, create the pod with kubectl apply -f, and read it back with -o yaml.

    A Kubernetes object is a YAML file with four top-level keys: apiVersion (which API and version), kind (what sort of object), metadata (its name and labels) and spec (what you want). Indentation is the nesting: two spaces = one level down, a dash starts a list item.

    Commands taughtk8s-yamlk8s-yaml-pod

    ▶ Play: Write a Pod, line by lineSOLUTION HIDDEN25 XP
  5. 21

    Level 21: Write it down

    GuidedEasy

    Objective: Generate lamp.yaml (pod lamp, image nginx:1.26) in ~/kube/k16-pods with --dry-run=client -o yaml, then create the pod with kubectl apply -f.

    Objects are YAML: apiVersion, kind, metadata, spec. Let kubectl write it: --dry-run=client -o yaml prints it without creating anything; save with > FILE, then kubectl apply -f FILE. The file is the truth you keep in git (the CKAD/CKA habit).

    ▶ Play: Write it downSOLUTION HIDDEN25 XP
  6. 22

    Level 22: Stuck at the dock

    GuidedEasy

    Objective: The pod crane has been Pending since the morning. Find the Reason of its warning event and tell Kern: kern REASON.

    kubectl describe pod NAME tells one object's story and ends with its Events: what the scheduler and kubelet did, and why they failed. hidden lists the namespace's events. Pending = never placed on a node.

    Commands taughtkubectl-describe

    ▶ Play: Stuck at the dockSOLUTION HIDDEN25 XP
  7. 23

    Level 23: A pod that will not start

    GuidedEasy

    Objective: Start a postgres pod called db, watch it crash, read its logs and its previous logs, then remove it.

    kubectl logs POD prints what the container wrote. A crashing container restarts, so its current log may be empty: kubectl logs POD --previous (short -p) shows the run that died. This database image crashes until it gets a password.

    Commands taughtkubectl-logs

    ▶ Play: A pod that will not startSOLUTION HIDDEN20 XP
  8. 24

    Level 24: Same verb, one flag at a time

    GuidedEasy

    Objective: On the buoy fleet: try -n, --show-labels, -l and -o on get, describe with -l, then delete one pod by name and one by label.

    kubectl VERB RESOURCE [NAME] [flags]. Get, describe and delete take the same few flags: -n NAMESPACE picks a namespace, -l key=value selects by label, -o wide / yaml / jsonpath='...' picks the output shape.

    ▶ Play: Same verb, one flag at a timeSOLUTION HIDDEN20 XP
  9. 25

    Level 25: The shipper's log

    AloneMedium

    Objective: The pod shop has a sidecar container that ships crates. One crate was lost: read the sidecar's log and tell Kern the crate number: kern NUMBER.

    kubectl logs POD shows what a container printed. With several containers (here web + a sidecar named shipper) use -c CONTAINER. After a crash, --previous (-p) shows the log of the container that died.

    ▶ Play: The shipper's logSOLUTION HIDDEN30 XP
  10. 26

    Level 26: Replace a pod

    GuidedEasy

    Objective: Create pod gull from gull.yaml, replace it after an image change, see a refused change (an env var), then force the replace.

    kubectl replace -f FILE swaps the live object for the file's version. A running pod only accepts a few edits (the image, for instance); any other change is refused. kubectl replace --force -f FILE then deletes the pod and creates it again from the file.

    ▶ Play: Replace a podSOLUTION HIDDEN25 XP
  11. 27

    Level 27: Stick a label on

    GuidedEasy

    Objective: Label buoy-2 zone=dock, label the whole app=buoy group, overwrite a value, then remove a label.

    Labels are free-form key=value notes on any object. kubectl label TYPE NAME key=value adds one; with -l SELECTOR it labels every match; key- (a trailing dash) removes one; --overwrite changes an existing value.

    Commands taughtk8s-labels

    ▶ Play: Stick a label onSOLUTION HIDDEN20 XP
  12. 28

    Level 28: Tag the buoys

    Alone⏱ TimedHard

    Objective: Quick: tag every app=buoy pod with zone=harbor (the lighthouse stays untagged) and remove the debug label from every pod.

    Labels are key=value tags; selectors pick by them: -l app=buoy, -l debug (key exists). --show-labels shows them; kubectl label pods -l SEL k=v tags every match, k- removes a label, --overwrite changes one.

    ▶ Play: Tag the buoysSOLUTION HIDDEN40 XP
  13. 29

    Level 29: The café keeps sinking

    Boss⏱ TimedHard

    Objective: Kern's café pod keeps crashing. Diagnose it, fix ~/kube/k16-pods/cafe.yaml and bring the café back to Running.

    CrashLoopBackOff: the container keeps exiting and the kubelet waits longer each time before restarting it. Method: describe → logs --previous → fix → verify. A bare Pod's spec is mostly immutable: fix the YAML and replace --force.

    Commands taughtcrashloop

    ▶ Play: The café keeps sinkingSOLUTION HIDDEN90 XP

World 4Deploy Docks

10 levels

Stop babysitting pods: Deployments keep them alive, scale them, roll new versions out and back; Jobs do the night work.

  1. 30

    Level 30: Unsinkable

    GuidedEasy

    Objective: Create a Deployment dock (nginx:1.27, 3 replicas), look at it, its ReplicaSet and pods, then delete its pods and watch new ones appear.

    A Deployment keeps N pods of a template running: it makes a ReplicaSet, which makes the pods and replaces any that vanish (the Fleet Yard's reconcile loop). kubectl create deployment NAME --image=IMG --replicas=N.

    Commands taughtk8s-deployment

    ▶ Play: UnsinkableSOLUTION HIDDEN25 XP
  2. 31

    Level 31: A Deployment, written down

    GuidedEasy

    Objective: Write quay.yaml (a Deployment of 2 nginx pods) in three pieces, apply it, then change replicas in the file and apply again.

    A Deployment's YAML is a Pod's YAML wrapped one level deeper: spec.replicas says how many, spec.selector says which pods are yours, and spec.template is the Pod to stamp out (its labels must match the selector). apiVersion here is apps/v1.

    Commands taughtk8s-yaml-deployment

    ▶ Play: A Deployment, written downSOLUTION HIDDEN25 XP
  3. 32

    Level 32: More cranes

    GuidedEasy

    Objective: A ship is coming in: scale the crane Deployment from 2 to 5 replicas and check that all 5 are Ready.

    kubectl scale deployment NAME --replicas=N changes the desired count; the ReplicaSet adds or removes pods to match. It only changes spec.replicas: same template, same pods kept.

    Commands taughtkubectl-scale

    ▶ Play: More cranesSOLUTION HIDDEN20 XP
  4. 33

    Level 33: New engines

    GuidedEasy

    Objective: Upgrade the ferry Deployment (container web) from nginx:1.26 to nginx:1.27, record the change-cause "nginx 1.27", then check the rollout status and history.

    Changing the pod template (kubectl set image deployment/NAME CONTAINER=IMAGE) rolls out a new ReplicaSet while the old one shrinks. rollout status follows it; rollout history shows CHANGE-CAUSE, the annotation kubernetes.io/change-cause.

    Commands taughtkubectl-rollout

    ▶ Play: New enginesSOLUTION HIDDEN30 XP
  5. 34

    Level 34: Back to port

    GuidedEasy

    Objective: Someone kept experimenting on the tug Deployment. Roll it back to the revision whose change-cause says stable, and check all 3 pods run it.

    kubectl rollout undo deployment/NAME goes back one revision; --to-revision=N goes to a specific one from rollout history (history --revision=N shows its template). An undo is itself a new rollout: the old ReplicaSet scales back up and gets a new revision number.

    Commands taughtkubectl-rollout-undo

    ▶ Play: Back to portSOLUTION HIDDEN30 XP
  6. 35

    Level 35: See another namespace

    GuidedEasy

    Objective: In namespace tide: list its pods with -n, describe them by label, read a rollout history, then make tide your current namespace.

    Objects live in namespaces. -n NAME looks into one; kubectl config set-context --current --namespace=NAME changes your default so every later command works there. kubectl describe -l and rollout history also take -n.

    Commands taughtk8s-namespace

    ▶ Play: See another namespaceSOLUTION HIDDEN20 XP
  7. 36

    Level 36: A dock of our own

    AloneMedium

    Objective: Create the namespace docks, make it your current namespace, and run a Deployment crane (nginx:1.27, 2 replicas) in it.

    Namespaces split a cluster into named rooms. kubectl create namespace NAME; -n NAME on any command, -A for all. kubectl config set-context --current --namespace=NAME changes your default namespace.

    ▶ Play: A dock of our ownSOLUTION HIDDEN30 XP
  8. 37

    Level 37: Run a CronJob now

    GuidedEasy

    Objective: List the CronJob nightly, create a Job from it called backup-try, and check it completed.

    A CronJob stamps out Jobs on a schedule. To run one right now, create a Job from it: kubectl create job NAME --from=cronjob/CRONJOB.

    Commands taughtk8s-job

    ▶ Play: Run a CronJob nowSOLUTION HIDDEN20 XP
  9. 38

    Level 38: Night shift

    Alone⏱ TimedHard

    Objective: Run the CronJob nightly now as Job backup-now, and Job tally (kern/backup:1.0, 3 completions, backoffLimit 2) from ~/kube/k16b-deploys/tally.yaml.

    A Job runs pods until they succeed: completions = successes needed, backoffLimit = failures allowed. A CronJob makes Jobs on a schedule; create job NAME --from=cronjob/CJ runs one now. DaemonSet = one pod per node.

    Commands taughtk8s-daemonset

    ▶ Play: Night shiftSOLUTION HIDDEN40 XP
  10. 39

    Level 39: Typo at high tide

    Boss⏱ TimedHard

    Objective: In namespace tide, harbor-web's stuck upgrade must be diagnosed, rolled back without losing a healthy pod, then shipped right and scaled to 6.

    ImagePullBackOff: the node cannot pull the image (typo, missing tag, private registry) and retries with back-off. With maxUnavailable 0 the old pods keep serving and the rollout just hangs. Diagnose, roll back, ship the right image.

    Commands taughtimagepullbackoff

    ▶ Play: Typo at high tideSOLUTION HIDDEN100 XP

World 5Config Vault

9 levels

The café's settings, passwords and appetites: ConfigMaps, Secrets and the CPU and memory every pod asks for.

  1. 40

    Level 40: A ConfigMap, written down

    GuidedEasy

    Objective: Write shelf.yaml (kind ConfigMap with two keys), apply it, read it back, then make a second ConfigMap from a file.

    A ConfigMap keeps settings outside the image: kind ConfigMap and a data: map of key: value. Write it as YAML, or build it from a file with kubectl create configmap NAME --from-file=FILE (the file name becomes the key).

    Commands taughtk8s-configmapk8s-yaml-configmap

    ▶ Play: A ConfigMap, written downSOLUTION HIDDEN20 XP
  2. 41

    Level 41: The settings jar

    GuidedEasy

    Objective: Create ConfigMap cafe-config with CAFE_DB_HOST=db.cafe and MODE=day, and ConfigMap menu from the file ~/kube/k17/menu.json.

    A ConfigMap holds settings as key/value pairs outside the image, so one image runs everywhere with different settings. --from-literal=KEY=value adds one key per flag; --from-file=FILE adds a key named after the file, holding the whole file.

    ▶ Play: The settings jarSOLUTION HIDDEN25 XP
  3. 42

    Level 42: Settings in the blood

    GuidedEasy

    Objective: Run pod cafe (kern/cafe:v2) with CAFE_DB_HOST via valueFrom from cafe-config, and pod cafe-all (kern/cafe:v2) with all of cafe-config via envFrom.

    A container reads a ConfigMap as environment variables: env[].valueFrom.configMapKeyRef picks ONE key (and can rename it), envFrom[].configMapRef takes EVERY key as a variable. A missing ConfigMap or key → CreateContainerConfigError.

    Commands taughtk8s-env-from

    ▶ Play: Settings in the bloodSOLUTION HIDDEN25 XP
  4. 43

    Level 43: Menu on the wall

    GuidedEasy

    Objective: Pod cafe3 (kern/cafe:v3) is crashing. Recreate it with the ConfigMap menu mounted at /etc/cafe (keep envFrom cafe-config) so it runs.

    A ConfigMap can also be a volume: each key becomes a file (menu.json) in the folder of the volumeMount. kern/cafe:v3 reads /etc/cafe/menu.json and panics without it. A pod's volumes can't be changed in place: delete it and create it again (a Deployment would roll it for you).

    Commands taughtk8s-configmap-volume

    ▶ Play: Menu on the wallSOLUTION HIDDEN30 XP
  5. 44

    Level 44: Not a safe

    GuidedEasy

    Objective: Read the password in the Secret cafe-db and tell Kern the decoded value with kern PASSWORD.

    A Secret is like a ConfigMap whose values are base64. base64 is an ENCODING, not encryption: whoever can read the Secret can decode it. -o jsonpath='{.data.KEY}' prints one value, base64 -d decodes it. Real protection: RBAC and encryption at rest.

    Commands taughtk8s-secret

    ▶ Play: Not a safeSOLUTION HIDDEN30 XP
  6. 45

    Level 45: How much does it eat?

    GuidedEasy

    Objective: Run a deployment pans, look at its use with top, then set requests and a limit with kubectl set resources.

    hidden shows live CPU and memory use. kubectl set resources changes a Deployment's requests (what it reserves; the scheduler counts them) and limits (the ceiling: pass the memory limit and the container is killed).

    Commands taughtk8s-resources

    ▶ Play: How much does it eat?SOLUTION HIDDEN20 XP
  7. 46

    Level 46: Three appetites

    AloneMedium

    Objective: Run three nginx:1.27 pods: be as BestEffort, burst as Burstable and gold as Guaranteed (check .status.qosClass).

    requests = what the scheduler reserves; limits = the ceiling (CPU throttled, memory OOMKilled). QoS class: BestEffort (none set), Burstable (some), Guaranteed (cpu AND memory limits = requests). Short on memory, a node evicts BestEffort first.

    ▶ Play: Three appetitesSOLUTION HIDDEN35 XP
  8. 47

    Level 47: The bakery's budget

    Alone⏱ TimedHard

    Objective: Get bread (namespace bakery) running. Keep the quota; add a LimitRange (requests cpu 100m, memory 64Mi; memory limit 128Mi) and the missing Secret.

    A ResourceQuota caps a namespace's totals. Once it covers cpu or memory, every new pod there MUST declare them, or: forbidden: failed quota: … must specify …. A LimitRange fills in defaults for containers that declare nothing. bread also needs its Secret bread-db (key password).

    Commands taughtk8s-quota

    ▶ Play: The bakery's budgetSOLUTION HIDDEN45 XP
  9. 48

    Level 48: Boss: The hungry kitchen

    Boss⏱ TimedHard

    Objective: Diagnose menu-api (Pending) and hog (OOMKilled) and right-size both deployments so their pods run.

    Two deployments are broken by their numbers: menu-api asks for more CPU than any node has (Pending, FailedScheduling), and hog uses more memory than its limit (the kernel OOM-kills it: OOMKilled, exit 137). Read the evidence, then right-size both.

    ▶ Play: Boss: The hungry kitchenSOLUTION HIDDEN90 XP

World 6Service Town

9 levels

Pods come and go with new IPs. Services, DNS names, Ingress and NetworkPolicies are how anything ever finds them.

  1. 49

    Level 49: A sign on the door

    GuidedEasy

    Objective: Expose deployment menu (the café listens on 8080) as Service menu on port 80, then fetch http://menu from the client pod with kubectl exec … wget.

    Pod IPs change whenever pods are replaced. A Service gives a stable IP and name; its selector picks pods and its Endpoints list each matching Ready pod's IP:port. kubectl expose deploy NAME --port=80 --target-port=8080: port for clients, targetPort = the container's.

    Commands taughtk8s-service

    ▶ Play: A sign on the doorSOLUTION HIDDEN25 XP
  2. 50

    Level 50: A Service, written down

    GuidedEasy

    Objective: Write menu-yaml.yaml (a Service for the pods labelled app: menu), apply it, and check it found its pods.

    A Service is a stable name and IP in front of changing pods: spec.selector says which pods (by label), spec.ports maps port (what clients use) to targetPort (what the container listens on).

    Commands taughtk8s-yaml-service

    ▶ Play: A Service, written downSOLUTION HIDDEN20 XP
  3. 51

    Level 51: Not ready yet

    GuidedEasy

    Objective: Service soup has no endpoints: its readiness probe asks /readyz. Point readiness at /ready (keep liveness on /healthz). The YAML is in ~/kube/k17b/soup.yaml.

    A readinessProbe decides if a pod gets traffic: not ready → removed from the Service's endpoints (pod still runs). A livenessProbe decides if the container is alive: failing → the kubelet restarts it. kern/cafe answers /ready for readiness and /healthz for liveness.

    Commands taughtk8s-probes

    ▶ Play: Not ready yetSOLUTION HIDDEN30 XP
  4. 52

    Level 52: Phone book

    GuidedEasy

    Objective: From pod client (namespace default), resolve the Service oven in namespace kitchen with nslookup, and tell Kern the address it returns: kern IP.

    CoreDNS (10.96.0.10) names every Service: oven in its own namespace, oven.kitchen from other namespaces, oven.kitchen.svc.cluster.local in full. Short names only work in the same namespace (resolv.conf search list). Ask from inside: kubectl exec client -- nslookup NAME.

    Commands taughtk8s-dns

    ▶ Play: Phone bookSOLUTION HIDDEN30 XP
  5. 53

    Level 53: The front gate

    GuidedEasy

    Objective: Create Ingress cafe (class nginx): host cafe.local → Service menu:80, host tea.local → Service tea:80. Then fetch http://tea.local from the client pod.

    An Ingress is HTTP routing (host, path → Service:port) for an ingress controller, here ingress-nginx (ingressClassName nginx). kubectl create ingress NAME --class=nginx --rule="HOST/PATH=SVC:PORT". SIM: cluster DNS answers each Ingress host with the controller's IP.

    Commands taughtk8s-ingress

    ▶ Play: The front gateSOLUTION HIDDEN35 XP
  6. 54

    Level 54: Fix a Service in place

    GuidedEasy

    Objective: Expose deployment menu with a wrong targetPort, spot it, fix it with patch -p, then change a replica count with a JSON patch.

    kubectl expose makes a Service for a Deployment: --name, --type (ClusterIP, NodePort, LoadBalancer), --port, --target-port. kubectl patch changes a live object without a file: -p takes a JSON snippet that is merged in; --type=json takes a list of operations.

    ▶ Play: Fix a Service in placeSOLUTION HIDDEN20 XP
  7. 55

    Level 55: Doors to the street

    AloneMedium

    Objective: For deployment menu make Service menu-np (NodePort, 80 → 8080, nodePort 30080) and Service menu-lb (LoadBalancer, 80 → 8080). Both need endpoints.

    type: NodePort opens one port (30000–32767) on EVERY node and forwards it to the Service. type: LoadBalancer also asks the cloud for an external load balancer; on a bare cluster nobody answers, so EXTERNAL-IP stays <pending>.

    Commands taughtk8s-nodeport

    ▶ Play: Doors to the streetSOLUTION HIDDEN40 XP
  8. 56

    Level 56: Members only

    Alone⏱ TimedHard

    Objective: In default: policy default-deny (all pods, Ingress, no rules) and policy allow-client (app=client → app=web, TCP 80). Prove client still gets http://web.

    By default any pod reaches any pod. A NetworkPolicy selects pods; once selected for Ingress, only listed sources get in. podSelector: {} + policyTypes [Ingress] + no rules = default deny. Policies add up. The CNI enforces them (SIM: exec wget/nslookup).

    Commands taughtk8s-networkpolicy

    ▶ Play: Members onlySOLUTION HIDDEN50 XP
  9. 57

    Level 57: Boss: The café is down

    Boss⏱ TimedHard

    Objective: Get http://cafe answering from the client pod: fix the Service's selector and targetPort and the deployment's readiness probe.

    The café's pods run, but http://cafe from the client pod fails. A Service reaches nothing when its selector matches no pod labels, when its targetPort isn't the container's port, or when the pods aren't Ready. This one has all three.

    ▶ Play: Boss: The café is downSOLUTION HIDDEN100 XP

World 7Guard Tower

8 levels

Every pod has an identity and every identity has keys. Hand out exactly the keys a job needs, prove it, and lock the doors.

  1. 58

    Level 58: Name badge

    GuidedEasy

    Objective: In namespace tower, create the ServiceAccount scribe and run a pod ledger (busybox:1.37, sleep 86400) as scribe, without a mounted token.

    Every pod runs as a ServiceAccount (default: default). Its token is mounted at /var/run/secrets/kubernetes.io/serviceaccount so the pod can call the API. A pod that never calls the API shouldn't carry one: automountServiceAccountToken: false.

    Commands taughtk8s-serviceaccount

    ▶ Play: Name badgeSOLUTION HIDDEN25 XP
  2. 59

    Level 59: One room, one key

    GuidedEasy

    Objective: In tower: Role reader (get, list, watch pods + get pods/log), given to the ServiceAccount tower:scribe by a RoleBinding scribe-reads.

    RBAC only allows. A Role lists rules (apiGroups, resources, verbs) in one namespace; a RoleBinding gives it to subjects (User, Group, ServiceAccount): kubectl create role … --verb --resource; kubectl create rolebinding … --role --serviceaccount NS:NAME.

    Commands taughtk8s-rbac-role

    ▶ Play: One room, one keySOLUTION HIDDEN25 XP
  3. 60

    Level 60: Ask the guard

    GuidedEasy

    Objective: Three ServiceAccounts live in tower: bell, lamp and quill. Only one of them may delete pods in tower. Find it with kubectl auth can-i and tell Kern: kern NAME.

    kubectl auth can-i VERB RESOURCE asks the API server's authorizer: yes or no. Add --as=system:serviceaccount:NAMESPACE:NAME to ask for someone else (impersonation, needs admin rights) and -n for the namespace. --list prints everything that identity may do there.

    Commands taughtkubectl-auth-can-i

    ▶ Play: Ask the guardSOLUTION HIDDEN25 XP
  4. 61

    Level 61: Master keys

    GuidedEasy

    Objective: Let tower:watcher list pods in every namespace, and give tower:helper the built-in ClusterRole edit, but only inside yard.

    A ClusterRole is a Role without a namespace. Bound by a ClusterRoleBinding it works in EVERY namespace (and for nodes etc.). Bound by a RoleBinding it works only in that binding's namespace: reuse one definition (like the built-in edit) per namespace.

    Commands taughtk8s-clusterrole

    ▶ Play: Master keysSOLUTION HIDDEN30 XP
  5. 62

    Level 62: The manual

    GuidedEasy

    Objective: Audit: 'a process must not gain more privileges than its parent'. Find that securityContext field with kubectl explain and tell Kern: kern FIELD.

    Nobody memorises the API. kubectl explain RESOURCE.FIELD.FIELD prints a field's type and docs from the server (pod.spec.containers.securityContext …); --recursive shows the tree below. Allowed in CKA/CKAD and faster than any search.

    Commands taughtkubectl-explain

    ▶ Play: The manualSOLUTION HIDDEN25 XP
  6. 63

    Level 63: Roll an image, as someone else

    GuidedEasy

    Objective: In namespace shop, roll storefront's web container to nginx:1.27 as yourself, then roll it again as the ci-bot ServiceAccount.

    kubectl set image deploy/NAME CONTAINER=IMAGE rolls a Deployment to a new image. -n picks the namespace, and --as=USER asks the API server to treat you as another identity (a ServiceAccount is system:serviceaccount:NAMESPACE:NAME): the way to test what a bot can do.

    ▶ Play: Roll an image, as someone elseSOLUTION HIDDEN20 XP
  7. 64

    Level 64: Not as root

    Alone⏱ TimedHard

    Objective: In tower, run pod safe (kern/api:1.1, container api): UID 1000 non-root, read-only root fs, no privilege escalation, no capabilities. Prove it: exec id.

    securityContext hardens a pod: runAsNonRoot (kubelet refuses root), runAsUser (the UID), readOnlyRootFilesystem, hidden, capabilities drop [ALL]. Pod-level fields apply to all containers; container-level ones win.

    ▶ Play: Not as rootSOLUTION HIDDEN40 XP
  8. 65

    Level 65: Keys for the robot

    Boss⏱ TimedHard

    Objective: shop:ci-bot may only roll out deployment images in shop: no secrets, no other namespaces. Cut its old access, grant the minimum, prove it as the bot.

    Least privilege: give an identity exactly the verbs on exactly the resources in exactly the namespace its job needs, nothing more, and prove both the yes and the no.

    ▶ Play: Keys for the robotSOLUTION HIDDEN90 XP

World 8Storage & Ops

10 levels

Day two: disks that outlive pods, reading a busy cluster fast, scaling with the rush, servicing nodes, and shipping a whole app in one go.

  1. 66

    Level 66: The pantry

    GuidedEasy

    Objective: Create claim beans (1Gi, RWO) and see it wait, mount it in pod roaster so it binds, then claim the static volume pv-archive with a PVC archive.

    A PVC asks for storage (size, access mode); a PV is the disk. A StorageClass makes PVs on demand. The default class here (like kind) is WaitForFirstConsumer: Pending until a pod uses it. Admins can also pre-make PVs for claims with storageClassName: "".

    Commands taughtk8s-storage

    ▶ Play: The pantrySOLUTION HIDDEN30 XP
  2. 67

    Level 67: Stuck in the pantry

    Alone⏱ TimedHard

    Objective: The claims menu, photos and logs (claims.yaml) should bind to the static PVs pv-menu, pv-photos, pv-logs. Fix claims.yaml until all are Bound.

    A Pending PVC always has a reason in kubectl describe pvc: a class that doesn't exist (ProvisioningFailed), no PV big enough, or no PV offering that access mode (FailedBinding). A claim's spec can't be edited after creation: fix the YAML, delete the claim and apply it again.

    ▶ Play: Stuck in the pantrySOLUTION HIDDEN40 XP
  3. 68

    Level 68: Speed reading

    GuidedEasy

    Objective: In namespace orders, tell Kern (kern ANSWER): till's image, the pod whose ServiceAccount isn't default, and the oldest pod.

    -o jsonpath='{.spec.replicas}' prints one field, -o custom-columns=NAME:.metadata.name,SA:.spec.serviceAccountName builds your own table, --sort-by=.metadata.creationTimestamp sorts a list. CKA habit: never scroll YAML for one value.

    Commands taughtkubectl-output-formats

    ▶ Play: Speed readingSOLUTION HIDDEN30 XP
  4. 69

    Level 69: Close and open a node

    GuidedEasy

    Objective: Cordon worker-2, see SchedulingDisabled in hidden, then uncordon it.

    kubectl cordon NODE marks a node unschedulable: running pods stay, but no new pod lands there. kubectl uncordon NODE opens it again. A forgotten cordon is a classic reason pods stay Pending.

    ▶ Play: Close and open a nodeSOLUTION HIDDEN20 XP
  5. 70

    Level 70: Alarm board

    Alone⏱ TimedHard

    Objective: Two namespaces have trouble and a node was left cordoned. Find the Warnings cluster-wide and fix all three (café images: kern/cafe:v1 to v3; nodes: 2 CPUs).

    Events are the cluster's short-term memory (about an hour): hidden shows every recent problem in every namespace, newest last. Then describe the object it names.

    Commands taughtkubectl-events

    ▶ Play: Alarm boardSOLUTION HIDDEN45 XP
  6. 71

    Level 71: Lunch rush

    GuidedEasy

    Objective: Autoscale barista (2 to 6 replicas, 50% CPU), fix <unknown> with a 100m cpu request, then start the rush (kubesim/load=3) and watch it scale out.

    An HPA moves a Deployment's replicas to keep average CPU near a target, as a percent of each pod's cpu REQUEST (no request: <unknown>). SIM: no metrics-server here; KUBESIM fakes CPU and the annotation kubesim/load stands in for traffic.

    Commands taughtk8s-hpa

    ▶ Play: Lunch rushSOLUTION HIDDEN30 XP
  7. 72

    Level 72: Night maintenance

    GuidedEasy

    Objective: Drain worker-1 and bring it back, then reserve worker-2 for the roaster: taint it roaster=only:NoSchedule and let only the roaster deployment in.

    cordon = no new pods; drain = cordon + evict (controllers re-create pods elsewhere; --ignore-daemonsets); uncordon reopens. A taint key=value:NoSchedule keeps pods off unless they tolerate it. Field levels repeat this on a real cluster.

    Commands taughtkubectl-draink8s-taints

    ▶ Play: Night maintenanceSOLUTION HIDDEN35 XP
  8. 73

    Level 73: Autoscale in a namespace

    GuidedEasy

    Objective: In namespace orders: give deployment till a CPU request, autoscale it 2 to 4 at 60%, and check the HPA.

    kubectl autoscale deploy NAME --min --max --cpu-percent creates a HorizontalPodAutoscaler. -n puts the command in the right namespace, and the Deployment needs a CPU request, or the HPA cannot compute a percentage.

    ▶ Play: Autoscale in a namespaceSOLUTION HIDDEN20 XP
  9. 74

    Level 74: Files for a chart

    GuidedEasy

    Objective: Write Chart.yaml and values.yaml for a chart called notes, then use sed with & to extend a value.

    Helm packages a Kubernetes app as a chart: a folder with Chart.yaml (apiVersion v2, name, version) and values.yaml (default settings). These are plain files, so you can write them with printf. sed's & in a replacement stands for whatever the pattern matched.

    ▶ Play: Files for a chartSOLUTION HIDDEN20 XP
  10. 75

    Level 75: Ship the café

    Boss⏱ TimedHard

    Objective: Ship the café from release/: apply the folder, finish the deployment, fix what blocks traffic, prove http://cafe.local/menu answers from inside a pod.

    A release is many objects that depend on each other. kubectl apply -f DIR applies every file in the directory (alphabetical order, so 00-namespace.yaml goes first); re-run it after every fix, then verify end to end, the way a customer would.

    Commands taughtkubectl-apply-dir

    ▶ Play: Ship the caféSOLUTION HIDDEN100 XP

World 9Chart Harbor

15 levels

The café leaves the simulator: a real k3s cluster, your own namespace, and Helm to install, upgrade, roll back and write charts.

  1. 76

    Level 76: Hello, real cluster

    GuidedEasy

    Objective: Find the name of your namespace, then create a ConfigMap named hello in it with the key namespace set to that name.

    This is not KUBESIM. kubectl here talks to a real k3s cluster on the lab server. You own one namespace, chosen by your kubeconfig's context; the rest of the cluster answers Forbidden. Try hidden and see.

    Commands taughtk19-real-cluster

    ▶ Play: Hello, real clusterSOLUTION HIDDEN30 XP
  2. 77

    Level 77: The Helm toolbox

    GuidedEasy

    Objective: Type each Helm example Kern shows; nothing runs, and the next levels use every command for real.

    helm is one program with many sub-commands. Look at a chart (lint, template), find one (repo, search, show), pack one (package), run one (install, upgrade, rollback, uninstall) and read what happened (list, status, history, get).

    Commands taughtk19-helm

    ▶ Play: The Helm toolboxSOLUTION HIDDEN40 XP
  3. 78

    Level 78: One command, whole app

    GuidedEasy

    Objective: Install the chart in ~/charts/cafe as a release named web, then look at it with hidden and helm status.

    Helm installs a chart (a folder of YAML templates plus default values) as a release: a named, versioned copy of the app in your namespace. Helm keeps each release's history in Secrets next to it.

    Commands taughtk19-helm-install

    ▶ Play: One command, whole appSOLUTION HIDDEN30 XP
  4. 79

    Level 79: Values, not edits

    GuidedEasy

    Objective: Write ~/bakery.yaml with greeting "Fresh bread daily" and replicaCount 2, then install ~/charts/cafe as release bakery using that file.

    A chart's values.yaml holds its defaults. You override them at install time with --set key=value or with -f FILE. A values file in git is better than a long --set line: you can review it.

    Commands taughtk19-helm-values

    ▶ Play: Values, not editsSOLUTION HIDDEN35 XP
  5. 80

    Level 80: The upgrade that forgot

    GuidedEasy

    Objective: web runs 2 replicas. Change its greeting to "Now serving croissants" with helm upgrade, and keep the 2 replicas.

    helm upgrade renders the chart again and moves the release to a new revision. Trap: if you pass any --set or -f, Helm starts from the chart defaults again, not from your last values. --reuse-values keeps them.

    Commands taughtk19-helm-upgrade

    ▶ Play: The upgrade that forgotSOLUTION HIDDEN35 XP
  6. 81

    Level 81: Back to the croissants

    GuidedEasy

    Objective: Revision 3 of web broke its rollout. Find the revision that serves croissants and roll web back to it with Helm.

    Every upgrade is a revision. helm history lists them; helm get values --revision N shows one; helm rollback NAME N makes a NEW revision that copies N. In KUBESIM you used kubectl rollout undo: with Helm, undo through Helm, or the next upgrade brings the bad version back.

    Commands taughtk19-helm-rollback

    ▶ Play: Back to the croissantsSOLUTION HIDDEN40 XP
  7. 82

    Level 82: Look before you leap

    GuidedEasy

    Objective: Render ~/charts/cafe with ~/prod.yaml as release prod into ~/render/prod.yaml, without installing it. Then remove the stray release oops.

    helm template renders a chart to plain YAML on your side, without the cluster: review it, diff it, keep it. helm get manifest NAME shows what a live release applied. helm uninstall removes a release and its objects.

    Commands taughtk19-helm-template

    ▶ Play: Look before you leapSOLUTION HIDDEN35 XP
  8. 83

    Level 83: The kiosk won't build

    AloneMedium

    Objective: The chart in ~/charts/kiosk is broken. Make helm lint pass, install it as release kiosk, and make its page say Kiosk open.

    helm lint checks a chart: YAML, template syntax, required fields. It finds broken templates; it can't know that a value's name is misspelled, because a missing value just renders as nothing. Render and read too.

    Commands taughtk19-helm-lint

    ▶ Play: The kiosk won't buildSOLUTION HIDDEN45 XP
  9. 84

    Level 84: A chart of your own

    AloneMedium

    Objective: Write chart ~/charts/notes (version 0.1.0): ConfigMap <release>-notes, key message from .Values.message (default hello). Install as jot, message=ship-it.

    A chart is just files: Chart.yaml (apiVersion v2, name, version), values.yaml (defaults) and templates/ (YAML with {{ }} holes). .Release.Name is the release's name, .Values.x a value. helm create makes a big starter chart; this one is tiny.

    Commands taughtk19-helm-chart

    ▶ Play: A chart of your ownSOLUTION HIDDEN50 XP
  10. 85

    Level 85: Loops and helpers

    AloneMedium

    Objective: In ~/charts/cafe: list each .Values.menu item on its own page line, add .Values.extraLabels in the cafe.labels helper. Install as menu with -f ~/menu.yaml.

    Templates are Go templates: {{ range .Values.list }} repeats, {{ with .Values.x }} runs only when x is set, define and include reuse a block (see templates/_helpers.tpl), toYaml prints a map, nindent fixes its indentation.

    Commands taughtk19-helm-templating

    ▶ Play: Loops and helpersSOLUTION HIDDEN55 XP
  11. 86

    Level 86: The lab chart repository

    AloneMedium

    Objective: Add the lab chart repo http://registry.ptr:5000/pkg/charts as lab, list lab/cafe's versions, and install release shop from lab/cafe 0.2.0 (the tested one).

    Teams publish charts in a repository: an index.yaml plus .tgz files on any web server. helm repo add names it, helm search repo lists charts and versions, --version pins one. Pin what you tested: the newest isn't always it.

    Commands taughtk19-helm-repo

    ▶ Play: The lab chart repositorySOLUTION HIDDEN45 XP
  12. 87

    Level 87: Ship it as a package

    AloneMedium

    Objective: notes chart: add value owner (default kern) as ConfigMap key owner, bump to 0.2.0, package into ~/dist, upgrade jot from the .tgz, keep message=ship-it.

    helm package turns a chart folder into NAME-VERSION.tgz, the file a repository serves. Bump version in Chart.yaml for every change: a version is a promise that its content never changes.

    Commands taughtk19-helm-package

    ▶ Play: Ship it as a packageSOLUTION HIDDEN50 XP
  13. 88

    Level 88: Deployed, and nobody home

    AloneMedium

    Objective: Release api says deployed but has no pods. Find out why and fix it through Helm. ~/api-values.yaml is the source of truth.

    helm says deployed when the API server ACCEPTED the objects, not when pods run. A Deployment can be accepted and still make no pods. Read events (hidden, kubectl describe rs). Fix it in the values file and upgrade: a kubectl fix is undone by the next upgrade.

    Commands taughtk19-helm-debug

    ▶ Play: Deployed, and nobody homeSOLUTION HIDDEN55 XP
  14. 89

    Level 89: Pager: the upgrade that can't

    Alone⏱ TimedHard

    Objective: PAGE: release orders must run chart 0.4.0 from ~/charts/cafe-0.4.0, deployed, with 2 ready pods. The last upgrade failed.

    Some fields can't change after creation; a Deployment's selector is one. If a new chart version changes selector labels, helm upgrade fails with field is immutable and the release is marked failed. Delete that one object (a short outage), then upgrade: Helm creates it fresh.

    Commands taughtk19-helm-immutable

    ▶ Play: Pager: the upgrade that can'tSOLUTION HIDDEN70 XP
  15. 90

    Level 90: BOSS: Opening night

    Boss⏱ TimedHard

    Objective: Release night: deployed with ~/night-prod.yaml (greeting Opening night, 2 replicas), all pods ready, chart passing helm lint. Fix all in the way.

    Helm marks a release pending-upgrade before applying anything, deployed only at the end. If helm dies in between (a killed CI job), the mark stays and every upgrade says another operation is in progress. helm history shows it; a rollback clears it.

    Commands taughtk19-helm-pending

    ▶ Play: BOSS: Opening nightSOLUTION HIDDEN120 XP

For teachers

Use these levels with a class

SOLUTION HIDDEN Teachers see answer keys in the classroom.

For teachers
ROOTSPIRE
DiscsFor teachers
▶ Play freeLibrary 16 discsDiscsFor teachersLog in