Skip to content

Pod Security Admission: KCSA practice questions

Pod Security Admission is the built-in admission controller that enforces the Pod Security Standards. It replaced PodSecurityPolicy, which was deprecated in Kubernetes v1.21 and removed in v1.25. The standards define three levels. Privileged is unrestricted and allows known privilege escalations. Baseline is minimally restrictive: it blocks known privilege escalations while still admitting a default Pod.

By Ibrahim Yesilay · Published · Updated

Independent community practice, not affiliated with or endorsed by CNCF or The Linux Foundation.

What Pod Security Admission covers in KCSA

Pod Security Admission is the built-in admission controller that enforces the Pod Security Standards. It replaced PodSecurityPolicy, which was deprecated in Kubernetes v1.21 and removed in v1.25. The standards define three levels. Privileged is unrestricted and allows known privilege escalations. Baseline is minimally restrictive: it blocks known privilege escalations while still admitting a default Pod. Restricted is heavily restricted and follows current Pod hardening practice.

Configuration happens with namespace labels, so restrictions apply per namespace when Pods are created. Each label has the form pod-security.kubernetes.io/<MODE>: <LEVEL>, where the mode is enforce, audit or warn. Enforce rejects violating Pods, audit adds an annotation to the audit log event, and warn returns a warning to the user; in the latter two cases the Pod is still admitted. A namespace can use any or all modes at once, each with a different level, and an optional -version label pins the policy to a given Kubernetes release. Audit and warn are also applied to workload resources such as Deployments, but enforce applies only to the resulting Pod objects, so a non-compliant Deployment can be accepted and then fail to create Pods. Exemptions can be configured for usernames, runtime class names and namespaces.

What the levels check maps directly to securityContext fields. Baseline forbids privileged containers, sharing host namespaces through hostNetwork, hostPID and hostIPC, hostPath volumes, and adding capabilities beyond a default set. Restricted additionally requires runAsNonRoot: true, forbids runAsUser 0, requires allowPrivilegeEscalation: false, requires dropping ALL capabilities (only NET_BIND_SERVICE may be added back), and requires an explicit seccomp profile such as RuntimeDefault. These settings live in the container securityContext (capabilities.add and capabilities.drop, privileged, readOnlyRootFilesystem) or at Pod level (runAsUser, runAsNonRoot, fsGroup, seccompProfile).

The individual fields are worth knowing in their own right. allowPrivilegeEscalation controls the no_new_privs flag, which stops a process from gaining more privileges than its parent, for example through a setuid binary; if unset it defaults to true, and it cannot be false for a privileged container or one with CAP_SYS_ADMIN. readOnlyRootFilesystem mounts the root filesystem read-only, so an attacker cannot modify binaries or drop tools into the image. Setting automountServiceAccountToken: false on a Pod or ServiceAccount keeps API credentials out of workloads that do not need them, and the Pod setting takes precedence. Applying a level to a namespace does not change Pods that already run there; it is checked when Pods are created.

Pod Security Admission covers only these predefined checks. Rules beyond these predefined checks need a separate mechanism, such as a third-party admission plugin you deploy and configure yourself, which is the other replacement the PodSecurityPolicy removal notice names.

Key points

  • Modes: enforce rejects, audit annotates the audit event, warn returns a user warning.
  • Enforce mode is evaluated on Pods, not on Deployments or other workload templates.
  • Restricted requires runAsNonRoot, allowPrivilegeEscalation: false, drop ALL and a seccomp profile.
  • PodSecurityPolicy was removed in v1.25.

Three sample questions

30 KCSA questions on Pod Security Admission, 30 with explanations. How practice works

Question 1

How do you enable Pod Security Admission (PSA) in a Kubernetes cluster?
  1. A.Install the PSA plugin via kubectl
  2. B.Add 'PodSecurity' to the '--enable-admission-plugins' flag in the API server
  3. C.Apply a custom resource definition for PSA
  4. D.Use a third-party tool to enforce PSA
  5. E.Enable it in the kubelet configuration

Correct answer: B

To enable Pod Security Admission (PSA), you need to add 'PodSecurity' to the '--enable-admission-plugins' flag when starting the API server. This ensures that the PodSecurity admission controller is active and enforcing pod security standards.

Sources: Kubernetes API Server Flags, Pod Security Admission

Question 2

Can you enforce more than one Pod Security Admission (PSA) policy level concurrently within a single namespace?
  1. A.Yes, by applying multiple labels
  2. B.No, only one policy level per namespace
  3. C.Yes, but only with custom configurations
  4. D.Only if the namespace is partitioned
  5. E.It depends on the Kubernetes version

Correct answer: B

PSA policies are applied at the namespace level. Only one PSA policy level (privileged, baseline, or restricted) can be enforced per namespace for each mode (enforce, audit, or warn). This ensures clear and consistent policy enforcement.

Sources: Kubernetes Documentation, Red Hat Documentation

Question 3

Why might a pod retain privileged access even after applying the 'restricted' Pod Security Standard (PSS) or Pod Security Admission (PSA) policy to its namespace?

Select all that apply.

  1. A.The Pod Security Standard does not apply retroactively to existing pods
  2. B.The namespace labels required for policy enforcement are misconfigured or missing
  3. C.The Kubernetes API server does not support Pod Security Standards
  4. D.The pod specification explicitly overrides the policy
  5. E.Privileged access is always allowed regardless of policy

Correct answers: A, B

The 'restricted' Pod Security Standard or Pod Security Admission policy applies only to pods created or updated after the policy is enforced; existing pods are not automatically remediated. Enforcement also depends on correct namespace labeling (e.g., 'pod-security.kubernetes.io/enforce=restricted'). If these labels are missing or misconfigured, the policy will not be enforced on pods in that namespace.

Sources: Kubernetes Official Documentation - Pod Security Admission, Kubernetes Blog - Pod Security Standards

Practice this topic

Focus mode keeps every question on Pod Security Admission until you leave it. 10 free guest answers, then a free account; no credit card.

Or open KCSA practice across all topics.

Sources

The explanation above was checked against these official documents.