KCNA ยท Kubernetes security
What are SecurityContext, the Pod Security Standards and Pod Security Admission?
runAsNonRoot, capabilities, privileged, readOnlyRootFilesystem, Privileged/Baseline/Restricted profiles, Pod Security Admission.
Key points
- securityContext on a Pod or container controls privileges: runAsNonRoot, capabilities, privileged, readOnlyRootFilesystem, allowPrivilegeEscalation.
- Pod Security Standards: Privileged (unrestricted), Baseline (blocks known privilege escalations), Restricted (hardening best practice).
- Pod Security Admission enforces a profile per namespace via labels like pod-security.kubernetes.io/enforce.
- Modes: enforce, audit, warn.
Source: https://kubernetes.io/docs/concepts/security/pod-security-admission/
Practice questions
Which Pod Security Standards profile is the most restrictive?
- Privileged
- Baseline
- Restricted
- Hardened
Show answer
Answer: C. Restricted
Restricted follows current hardening practice. Baseline is minimally restrictive and Privileged is unrestricted.
Which settings does the Restricted profile require?
- runAsNonRoot set to true
- readOnlyRootFilesystem set to true
- allowPrivilegeEscalation set to false
- privileged set to true
- capabilities dropping ALL
Show answer
Answer: A. runAsNonRoot set to true, C. allowPrivilegeEscalation set to false, E. capabilities dropping ALL
Restricted requires non-root execution, disallowing privilege escalation and dropping all capabilities. Privileged containers are already forbidden at Baseline, and readOnlyRootFilesystem is good practice but not required by any profile.
True or false: the Baseline profile already requires containers to run as a non-root user.
Show answer
Answer: False
False. Baseline blocks known escalations such as privileged containers and host namespaces, but requiring runAsNonRoot is a Restricted control.
Practice 8 questions on this topic in Bitzu
Short lessons, instant explanations and spaced review of what you get wrong. Free on iOS and Android.
