Bitzu

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

Single choice

Which Pod Security Standards profile is the most restrictive?

  1. Privileged
  2. Baseline
  3. Restricted
  4. Hardened
Show answer

Answer: C. Restricted

Restricted follows current hardening practice. Baseline is minimally restrictive and Privileged is unrestricted.

Select all that apply

Which settings does the Restricted profile require?

  1. runAsNonRoot set to true
  2. readOnlyRootFilesystem set to true
  3. allowPrivilegeEscalation set to false
  4. privileged set to true
  5. 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

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.

Download on the App StoreGet it on Google Play

More KCNA topics in this module