Shellaro Download

Labs (0.9)

Hands-on troubleshooting practice: Shellaro deploys something broken on a cluster you choose, and you fix it in the terminal. Each task has a Check that tells you whether it is solved.

Doing a lab

  1. Open a lab: Marketplace > Labs, the Labs section of the sidebar's Extensions tab, or Start Lab... in the command palette.
  2. Read what it is about and what it needs, then click Start lab.
  3. Deploy on: choose a target.
    • Local cluster: if you have none, Launch local cluster creates one right there (Kubernetes in Docker on this computer, see local-cluster.md).
    • Any saved session with kubectl and a working cluster. Shellaro checks that kubectl works before running anything.
    • Production sessions cannot be chosen: labs break things on purpose.
  4. What the setup runs on the target shows the exact script. Deploy lab runs it.
  5. The lab panel opens under the terminal with the tasks. Work in the terminal. Check runs the task's check on the target; Hint 1 of 2 shows a task's hints one at a time (see Hints); tasks without a check have Mark as done.
  6. When every task is solved, the panel shows a summary: tasks completed, the time it took, and hints used (in total and per task). Review tasks goes back to the tasks; End lab and clean up runs the cleanup.
  7. Reset runs the cleanup and the setup again (a new attempt: progress, hints and the clock start over). End lab runs the cleanup. The lab, your progress and the hints you opened survive a restart of Shellaro.

Hints

Every task has at most two hints, and they open one at a time:

  1. Hint 1 points where to look (which command, which part of the output).
  2. Hint 2 is more direct, often the fix itself.

Opened hints stay visible for the rest of the attempt, also after a restart. The summary counts them ("Hints used 2 / 6"); nothing is deducted for using them.

One lab runs at a time. Everything a Kubernetes lab creates lives in its own namespace (lab-<name>), and End lab deletes it.

Labs that come with Shellaro

LabLevelWhat breaks
CrashLoopBackOffbeginnerAn API exits at start: a setting from a secret is missing
ImagePullBackOffbeginnerA release points at an image tag that does not exist
Service Without EndpointsintermediateA service selector does not match the pods' labels
Pod Stuck in PendingintermediateResource requests no node can satisfy

Making your own lab

A lab is a folder: a lab.json, a setup script that breaks something, and the tasks.

shellaro ext create pod-down --template lab --publisher acme
cd pod-down

You get:

manifest.json      type "labPack", id acme.pod-down
lab.json           requirements, namespace, setup, cleanup, tasks
scripts/setup.sh   creates the broken situation (edit this)
README.md          shown in the Marketplace

Try it while you write it: Settings > Developer > Load extension folder..., then Start Lab... in the palette. Every Start runs your current setup.sh. When it works:

shellaro ext build      # acme.pod-down-0.1.0.shellaro-ext
shellaro ext install    # or share the file, or publish --index

lab.json

{
  "schemaVersion": 1,
  "difficulty": "beginner",
  "estimatedMinutes": 10,
  "environment": { "provider": "kubernetes", "description": "Runs in the namespace lab-pod-down." },
  "requirements": ["A Kubernetes cluster: the local cluster (one click) or any server with kubectl"],
  "namespace": "lab-pod-down",
  "setup": { "script": "scripts/setup.sh" },
  "cleanup": { "commands": ["kubectl delete namespace lab-pod-down --ignore-not-found --wait=false"] },
  "tasks": [
    {
      "id": "find",
      "title": "Find what is wrong",
      "instructions": "Markdown, with `kubectl` examples.",
      "hints": ["Where to look: kubectl describe shows the pod's events.", "More direct: the image tag has a typo."]
    },
    {
      "id": "fix",
      "title": "Fix it",
      "instructions": "Make the deployment run.",
      "check": { "command": "kubectl -n lab-pod-down rollout status deploy/web --timeout=40s" }
    }
  ]
}
Field
environment.providerkubernetes (kubectl on the target) or ssh (any Linux server). docker (a lab with its own image) is planned.
requirementsShown before starting.
namespaceKubernetes labs: where everything goes. Exported to scripts as LAB_NAMESPACE. Shellaro waits for a previous copy of it to finish terminating before setup.
setup, cleanup{ "script": "scripts/x.sh" } (a file in the package, at most 10 KB) or { "commands": ["...", "..."] } (run in order with set -e). Without a cleanup, a Kubernetes lab's namespace is deleted.
tasks[].hintsAt most two. The first points where to look, the second is more direct (often the fix). shellaro ext validate rejects a task with more.
tasks[].checkcommand (or script), optional expectExitCode (default 0) and expectOutput (text the output must contain). A task without a check is marked done by the learner.

Writing the setup