- Split `scenarios/scenarios.json` into individual JSON files under `scenarios/data/` named `<scenario-id>.json` - Split `scenarios/bundles.json` into individual JSON files under `scenarios/bundles/` named `<bundle-id>.json` - Updated `backend/server.js` to dynamically load scenario and bundle files from their respective directories - Updated documentation in `scenarios/SCHEMA.md` and `README.md` to reflect the new repository layout and contributor workflow Signed-off-by: Abhinav Sinha <[email protected]>
40 lines
1.5 KiB
JSON
40 lines
1.5 KiB
JSON
{
|
|
"id": "kubectl-essentials-mcq",
|
|
"title": "Essential kubectl Commands",
|
|
"category": "Core Concepts",
|
|
"difficulty": "Easy",
|
|
"type": "mcq",
|
|
"weight": 2,
|
|
"description": "## Essential kubectl Commands\n\nYou need to quickly view the **logs** of a container named `api` inside a pod named `backend-7d9f`. The pod has multiple containers.\n\nWhich command is correct?",
|
|
"options": [
|
|
{
|
|
"id": "a",
|
|
"text": "`kubectl describe pod backend-7d9f`"
|
|
},
|
|
{
|
|
"id": "b",
|
|
"text": "`kubectl logs backend-7d9f`"
|
|
},
|
|
{
|
|
"id": "c",
|
|
"text": "`kubectl logs backend-7d9f -c api`"
|
|
},
|
|
{
|
|
"id": "d",
|
|
"text": "`kubectl exec backend-7d9f -- cat /var/log/api.log`"
|
|
}
|
|
],
|
|
"correct_option": "c",
|
|
"explanation": "When a pod has **multiple containers**, you must specify which container's logs you want using the `-c <container-name>` flag: `kubectl logs <pod-name> -c <container-name>`. Without `-c`, kubectl returns an error if the pod has more than one container. `kubectl describe` shows metadata and events, not live logs. `kubectl exec` can work but is cumbersome and container-runtime dependent.",
|
|
"hints": [
|
|
{
|
|
"title": "kubectl logs flags",
|
|
"body": "Key flags: `-c` (container name for multi-container pods), `-f` (follow/stream), `--previous` (crashed container logs), `--since=1h` (time filter).",
|
|
"command": "kubectl logs --help | head -30"
|
|
}
|
|
],
|
|
"setup_commands": [],
|
|
"default_namespace": "default",
|
|
"teardown_commands": []
|
|
}
|