0
0
Kubernetesdevops~20 mins

Pod security admission controller in Kubernetes - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Pod Security Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
1:30remaining
Understanding Pod Security Admission Controller Modes

Which mode of the Pod Security Admission Controller enforces policies and blocks pods that do not comply?

AWarn mode
BMonitor mode
CEnforce mode
DAudit mode
Attempts:
2 left
💡 Hint

Think about which mode actively stops non-compliant pods from running.

💻 Command Output
intermediate
2:00remaining
Pod Security Admission Controller Policy Enforcement Output

What is the output when a pod violates the 'restricted' Pod Security Admission policy in enforce mode?

Kubernetes
kubectl apply -f pod.yaml
AError from server (Forbidden): error when creating "pod.yaml": admission webhook "podsecurity.k8s.io" denied the request: restricted: forbidden fields present
BWarning: pod "mypod" violates policy but created
Cpod "mypod" created with warnings
Dpod "mypod" created
Attempts:
2 left
💡 Hint

Enforce mode blocks pods and returns an error message.

Configuration
advanced
2:30remaining
Configuring Pod Security Admission Controller for a Namespace

Which YAML snippet correctly configures the Pod Security Admission Controller to enforce the 'baseline' policy on the namespace 'dev-team'?

A
apiVersion: v1
kind: Namespace
metadata:
  name: dev-team
  annotations:
    pod-security.kubernetes.io/warn: baseline
B
apiVersion: v1
kind: Namespace
metadata:
  name: dev-team
  annotations:
    pod-security.kubernetes.io/enforce: baseline
C
apiVersion: v1
kind: Namespace
metadata:
  name: dev-team
  annotations:
    pod-security.kubernetes.io/enforce: restricted
D
apiVersion: v1
kind: Namespace
metadata:
  name: dev-team
  annotations:
    pod-security.kubernetes.io/audit: baseline
Attempts:
2 left
💡 Hint

Enforce annotation applies the policy strictly.

Troubleshoot
advanced
2:00remaining
Diagnosing Pod Creation Failure with Pod Security Admission Controller

A developer reports that their pod creation fails with the message: admission webhook "podsecurity.k8s.io" denied the request: restricted: forbidden fields present. What is the most likely cause?

AThe pod spec includes fields disallowed by the 'restricted' Pod Security policy enforced on the namespace.
BThe Kubernetes API server is down and cannot process the request.
CThe pod YAML file is missing required fields like 'metadata' or 'spec'.
DThe user does not have permission to create pods in the cluster.
Attempts:
2 left
💡 Hint

Focus on the 'forbidden fields present' part of the error message.

🔀 Workflow
expert
3:00remaining
Pod Security Admission Controller Policy Upgrade Workflow

You want to upgrade a namespace from 'baseline' to 'restricted' Pod Security policy without breaking existing workloads. Which sequence of steps is best?

A2,1,3,4
B3,1,2,4
C1,3,2,4
D1,2,3,4
Attempts:
2 left
💡 Hint

Think about a safe upgrade path that warns first before enforcing.