Pre-Phase-1 platform work, approved and tested earlier but not yet committed: - Terminal banner: "RootNode Academy Lab — node: k8s-lab", upstream KubeKosh attribution left untouched in footer/README/LICENSE. - RootNode curriculum mode: scenarios/rootnode-path.json (Foundation -> Workloads -> Networking -> Configuration -> Troubleshooting -> Real Ops -> Capstone), built from existing scenario content grouped by category, no new scenarios invented. New GET /api/curriculum/path endpoint. - Student roster + per-student progress: instructor-roster, pick-your-name login (no password), students/environments-adjacent progress table migrated to a (student_id, scenario_id) composite key so practice progress and exam sessions are isolated per student instead of one global bucket. New /api/roster, /api/login endpoints. - scenarios/data/*.json: added isolation_type metadata (shared_namespace vs ephemeral_cluster) from an audit of which scenarios execute cluster-scoped or node-level commands. This was Tier-1-isolation groundwork that got superseded same-day by the full-ephemeral-per-student architecture (see docs/LAB_ARCHITECTURE.md) — the field is kept as descriptive metadata only, per the note now in scenarios/SCHEMA.md. Not wasted: it's an accurate audit of which scenarios touch cluster-scoped resources, useful independent of isolation model. - .gitignore added (node_modules/, frontend/dist/, *.db, /data/, .env) — none existed before; without it, npm installs during testing would have landed in a commit. Known limitation still open: no frontend UI for any of this yet (login screen, roster-add form, curriculum view) — API-only. No auth on the roster-add endpoint. Co-Authored-By: Claude Sonnet 5 <[email protected]>
65 lines
2.8 KiB
JSON
65 lines
2.8 KiB
JSON
{
|
|
"id": "sort-by-basics",
|
|
"title": "Sorting kubectl Output",
|
|
"category": "Core Concepts",
|
|
"isolation_type": "shared_namespace",
|
|
"difficulty": "Easy",
|
|
"type": "task",
|
|
"weight": 3,
|
|
"description": "## Sorting `kubectl` Output\n\nThe `--sort-by` flag on `kubectl get` allows you to sort output by any JSONPath expression — extremely useful for finding the newest pod, the heaviest resource consumer, or the oldest event.\n\n**Your task:**\n\nSeveral pods have been created for you. Complete the following:\n\n1. List all pods in the `default` namespace **sorted by their creation timestamp** (oldest first) and save the output to `/tmp/pods-sorted.txt`\n2. List all pods sorted by name and save to `/tmp/pods-by-name.txt`\n\n```bash\n# Sort by creation time:\nkubectl get pods --sort-by=.metadata.creationTimestamp\n\n# Sort by name:\nkubectl get pods --sort-by=.metadata.name\n```",
|
|
"hints": [
|
|
{
|
|
"title": "--sort-by flag syntax",
|
|
"body": "Pass any JSONPath expression to --sort-by. The expression must point to a comparable field (string, number, or timestamp).",
|
|
"command": "kubectl get pods --sort-by=.metadata.creationTimestamp"
|
|
},
|
|
{
|
|
"title": "Save output to a file",
|
|
"body": "Redirect kubectl output using the > operator.",
|
|
"command": "kubectl get pods --sort-by=.metadata.creationTimestamp > /tmp/pods-sorted.txt && kubectl get pods --sort-by=.metadata.name > /tmp/pods-by-name.txt"
|
|
}
|
|
],
|
|
"setup_commands": [
|
|
{
|
|
"command": "kubectl run sort-pod-c --image=nginx:alpine 2>/dev/null || true && sleep 1"
|
|
},
|
|
{
|
|
"command": "kubectl run sort-pod-b --image=nginx:alpine 2>/dev/null || true && sleep 0.5"
|
|
},
|
|
{
|
|
"command": "kubectl run sort-pod-a --image=nginx:alpine 2>/dev/null || true && sleep 0.5"
|
|
}
|
|
],
|
|
"validation": {
|
|
"commands": [
|
|
{
|
|
"description": "File /tmp/pods-sorted.txt exists and contains pod output",
|
|
"command": "cat /tmp/pods-sorted.txt",
|
|
"expected_output": "sort-pod",
|
|
"match": "contains"
|
|
},
|
|
{
|
|
"description": "File /tmp/pods-by-name.txt exists and contains pod output",
|
|
"command": "cat /tmp/pods-by-name.txt",
|
|
"expected_output": "sort-pod",
|
|
"match": "contains"
|
|
},
|
|
{
|
|
"description": "pods-by-name.txt is sorted alphabetically (sort-pod-a appears before sort-pod-c)",
|
|
"command": "grep -n 'sort-pod-a' /tmp/pods-by-name.txt | cut -d: -f1",
|
|
"expected_output": "^[0-9]+$",
|
|
"match": "regex"
|
|
}
|
|
]
|
|
},
|
|
"default_namespace": "default",
|
|
"teardown_commands": [
|
|
{
|
|
"command": "kubectl delete pod sort-pod-a sort-pod-b sort-pod-c --ignore-not-found --grace-period=0 --force"
|
|
},
|
|
{
|
|
"command": "rm -f /tmp/pods-sorted.txt /tmp/pods-by-name.txt"
|
|
}
|
|
]
|
|
}
|