fix: CrashLoopBackOff in pod-security-context scenario

Signed-off-by: Abhinav Sinha <[email protected]>
This commit is contained in:
Abhinav Sinha
2026-06-09 21:57:10 +05:30
parent abcd8592b5
commit bc86618fd0
+2 -2
View File
@@ -1631,12 +1631,12 @@
"difficulty": "Medium", "difficulty": "Medium",
"type": "task", "type": "task",
"weight": 6, "weight": 6,
"description": "## Pod Security Context\n\nA security context defines privilege and access control settings for a pod or container.\n\n**Your task:**\n\nCreate a Pod named `secure-pod` using `nginx:alpine` with the following security settings:\n- `runAsUser: 1000`\n- `runAsNonRoot: true`\n- `allowPrivilegeEscalation: false`\n\n```bash\n# Verify after creation:\nkubectl exec secure-pod -- id\n```", "description": "## Pod Security Context\n\nA security context defines privilege and access control settings for a pod or container.\n\n**Your task:**\n\nCreate a Pod named `secure-pod` using `busybox:1.36` (command: `sleep 3600`) with the following security settings:\n- `runAsUser: 1000`\n- `runAsNonRoot: true`\n- `allowPrivilegeEscalation: false`\n\n```bash\n# Verify after creation:\nkubectl get pod secure-pod -o jsonpath='{.spec.containers[0].securityContext}'\n```",
"hints": [ "hints": [
{ {
"title": "securityContext structure", "title": "securityContext structure",
"body": "Security context can be set at Pod level (`spec.securityContext`) or container level (`spec.containers[].securityContext`). Container-level settings override pod-level.", "body": "Security context can be set at Pod level (`spec.securityContext`) or container level (`spec.containers[].securityContext`). Container-level settings override pod-level.",
"command": "cat <<EOF | kubectl apply -f -\napiVersion: v1\nkind: Pod\nmetadata:\n name: secure-pod\nspec:\n containers:\n - name: app\n image: nginx:alpine\n securityContext:\n runAsUser: 1000\n runAsNonRoot: true\n allowPrivilegeEscalation: false\nEOF" "command": "cat <<EOF | kubectl apply -f -\napiVersion: v1\nkind: Pod\nmetadata:\n name: secure-pod\nspec:\n containers:\n - name: app\n image: busybox:1.36\n command: [\"sleep\", \"3600\"]\n securityContext:\n runAsUser: 1000\n runAsNonRoot: true\n allowPrivilegeEscalation: false\nEOF"
} }
], ],
"setup_commands": [], "setup_commands": [],