Files
rootnode-academy/scenarios/data/rbac-role.json
T
ced4568andClaude Sonnet 5 60fbf0c385 feat(curriculum): add RootNode learning path, student roster, and scenario isolation metadata
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]>
2026-08-18 01:21:16 -05:00

81 lines
3.7 KiB
JSON

{
"id": "rbac-role",
"title": "RBAC: Create Role and RoleBinding",
"category": "Security",
"isolation_type": "shared_namespace",
"difficulty": "Hard",
"type": "task",
"weight": 9,
"description": "## Restrict Namespace Access with RBAC\n\nA CI/CD service account needs read-only access to pods and deployments in the `staging` namespace.\n\n**Your tasks:**\n1. Create namespace `staging`\n2. Create a **ServiceAccount** named `ci-reader` in the `staging` namespace\n3. Create a **Role** named `read-workloads` in `staging` that allows `get`, `list`, `watch` on `pods` and `deployments`\n4. Create a **RoleBinding** named `ci-reader-binding` that binds `read-workloads` to the `ci-reader` ServiceAccount\n5. Verify the ServiceAccount **can** list pods but **cannot** create them",
"hints": [
{
"title": "Create namespace and service account",
"body": "Create these first before the role, as the RoleBinding references both.",
"command": "kubectl create namespace staging\nkubectl create serviceaccount ci-reader -n staging"
},
{
"title": "Create the Role",
"body": "Use `kubectl create role` with multiple `--verb` and `--resource` flags.",
"command": "kubectl create role read-workloads \\\n --verb=get,list,watch \\\n --resource=pods,deployments \\\n -n staging"
},
{
"title": "Bind the Role",
"body": "RoleBinding ties a Role to a subject. ServiceAccount subjects need namespace-qualified names.",
"command": "kubectl create rolebinding ci-reader-binding \\\n --role=read-workloads \\\n --serviceaccount=staging:ci-reader \\\n -n staging"
},
{
"title": "Verify permissions with auth can-i",
"body": "Use `--as` to impersonate the service account and test its permissions.",
"command": "kubectl auth can-i list pods --as=system:serviceaccount:staging:ci-reader -n staging\nkubectl auth can-i create pods --as=system:serviceaccount:staging:ci-reader -n staging"
}
],
"setup_commands": [],
"validation": {
"description": "Validates the full RBAC chain: namespace, SA, role, rolebinding, and effective permissions.",
"commands": [
{
"description": "Namespace 'staging' exists",
"command": "kubectl get namespace staging -o jsonpath='{.metadata.name}'",
"expected_output": "staging",
"match": "exact"
},
{
"description": "ServiceAccount 'ci-reader' exists in staging",
"command": "kubectl get serviceaccount ci-reader -n staging -o jsonpath='{.metadata.name}'",
"expected_output": "ci-reader",
"match": "exact"
},
{
"description": "Role 'read-workloads' exists in staging",
"command": "kubectl get role read-workloads -n staging -o jsonpath='{.metadata.name}'",
"expected_output": "read-workloads",
"match": "exact"
},
{
"description": "RoleBinding 'ci-reader-binding' exists",
"command": "kubectl get rolebinding ci-reader-binding -n staging -o jsonpath='{.metadata.name}'",
"expected_output": "ci-reader-binding",
"match": "exact"
},
{
"description": "ci-reader CAN list pods",
"command": "kubectl auth can-i list pods --as=system:serviceaccount:staging:ci-reader -n staging",
"expected_output": "yes",
"match": "exact"
},
{
"description": "ci-reader CANNOT create pods",
"command": "kubectl auth can-i create pods --as=system:serviceaccount:staging:ci-reader -n staging",
"expected_output": "no",
"match": "exact"
}
]
},
"default_namespace": "default",
"teardown_commands": [
{
"command": "kubectl delete namespace staging --ignore-not-found --wait=false"
}
]
}