A namespace enforces the Pod Security Standard restricted. As an application developer you must keep the enforcement. Creating your Pod fails with violates PodSecurity "restricted:latest": allowPrivilegeEscalation != false. What should you do?
- A.
Relabel the namespace with
pod-security.kubernetes.io/enforce: privileged. - B.
Add a toleration for
node.kubernetes.io/unschedulable. - C.
Update the container
securityContextto comply, for exampleallowPrivilegeEscalation: false,runAsNonRoot: true,capabilities.drop: ["ALL"]and aseccompProfileofRuntimeDefault. - D.
Increase the Pod's memory limits.
Show answer and explanation
Answer: C
Pod Security admission rejects Pods that do not meet the namespace's level; the workload must be made compliant.
- Lowering the namespace policy is an administrator decision and removes the protection.
- Tolerations and memory limits have no effect on admission.