fix: CrashLoopBackOff in pod-security-context scenario
Signed-off-by: Abhinav Sinha <[email protected]>
This commit is contained in:
@@ -1631,12 +1631,12 @@
|
||||
"difficulty": "Medium",
|
||||
"type": "task",
|
||||
"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": [
|
||||
{
|
||||
"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.",
|
||||
"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": [],
|
||||
|
||||
Reference in New Issue
Block a user