kubestronaut-sim/cka/lessons.py
vumas3r e852419130 feat: teach a domain, its lessons back to back
Add runs of a domain's lessons: ./ksim lesson ARCH, the lobby's Teach
a domain card, or the Teach a domain session in the Start exam
dialog. A run is one lesson session over the domain's lessons not
done yet (--all: every one), each on its own host, all made before it
starts, so there is no waiting between lessons. The session keeps
the lesson you are on and each lesson's checks. A lesson's wrap-up
leads to the next, the list at the top of a lesson goes to any lesson
of the run, and ./ksim lesson next and ./ksim lesson OBJ do the same
in a terminal. Finishing the run sends you to the domain's drill.

Stamp a lesson done the moment its last step passes, not when the
session ends, so terminating a lesson or a run keeps what it taught.

Tested on a real STOR run in a copy of the repo: every host up before
step 1; lesson 1.1 done step by step through the CLI and the web API,
and stamped done as its last step passed; next, jump, a lesson
outside the run refused, and the finish report as expected.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 18:14:08 -06:00

29 lines
2.0 KiB
Python

"""CKA lessons: guided labs, one per curriculum objective, on a cluster of your own and without a
clock. A lesson explains, then walks you through steps that you do on its host; each step has a
check, a hint and the commands that do it. It ends by sending you to the objective's timed drill.
Lessons write nothing to the history or the scores - only a "lesson done" mark on the objective.
./ksim lesson the lessons of this track, and which you have done
./ksim lesson 1.1 start the lesson of objective 1.1 (id or key)
./ksim lesson STOR a domain's lessons not done yet, back to back; ./ksim lesson next moves on
./ksim lesson check check the step you are on; the next one follows
./ksim lesson audit [OBJ..] prove lessons: every step fails before its commands and passes after
A lesson's host is named after its id - lesson 9101 runs on `cka9101` - which never clashes with a
task's. Its files go under {WS}/lesson-<objective>/. A step's `show` commands are what the learner
types; the audit runs exactly them, as `candidate` on the host, so what a lesson shows always
works. Work on another node is shown as `ssh NODE sudo bash <<'EOF' ... EOF`: the same commands
you would type after `ssh NODE` and `sudo -i`, in a form that runs unattended. A single command
there is `ssh -n NODE 'COMMAND'`: without -n, ssh would read the rest of the commands as its input.
One file per domain, as with the task banks. Besides the curriculum's competencies, the lessons
cover what a full CKA course teaches under each of them (2026-10-19: the topics of KubeDojo's CKA
course, written here from scratch): projected volumes, eviction thresholds, debug containers,
kube-proxy's rules, encryption at rest, in-place resize, PodDisruptionBudgets, QoS classes,
ServiceAccount tokens, a real kubeadm upgrade, EndpointSlices.
"""
from cka import lessons_arch, lessons_net, lessons_storage, lessons_tshoot, lessons_work
LESSONS = (lessons_storage.LESSONS + lessons_tshoot.LESSONS + lessons_work.LESSONS
+ lessons_arch.LESSONS + lessons_net.LESSONS)