KCSA · Domain 3: Kubernetes Security Fundamentals · 22% of the exam
Task 3.2: Pod Security Admissions
The built-in Pod Security admission controller: enforce, audit and warn modes, namespace labels, versions and exemptions.
Study it
Pod Security Standards and Pod Security Admission
Lesson coming
Sample questions
Try each one before opening the answer. Every option is explained, with the CNCF documentation page that proves it.
Question 1 · choose 1
Namespace build enforces the Restricted standard, and several teams create Jobs there. The CI user ci-deployer must run privileged image builds in that namespace, and no other team may gain the ability to run Pods that violate Restricted. The CI pipeline currently creates a Job for each build, but the platform team may change how the pipeline submits its builds. Which plan meets both goals with the PodSecurity admission configuration?
AExempt ci-deployer by username and have the pipeline create the build Pods directly
BExempt the namespace build, and rely on RBAC to keep other teams' Pods unprivileged
CExempt ci-deployer by username and keep the Jobs; the exemption carries over to their Pods
DExempt the Job controller's service account, so that the build Jobs' Pods are admitted
Show the answer and why
AExempt ci-deployer by username and have the pipeline create the build Pods directly
Correct
Username exemptions skip checks for requests made by that user, and exempting an end user covers Pods the user creates directly, not Pods a controller creates from a workload resource.
BExempt the namespace build, and rely on RBAC to keep other teams' Pods unprivileged
Incorrect
Pods and workload resources in an exempt namespace are ignored by Pod Security admission, so every team's Pods there would escape the Restricted checks; RBAC does not inspect Pod security fields.
CExempt ci-deployer by username and keep the Jobs; the exemption carries over to their Pods
Incorrect
A Job's Pods are created by the Job controller, not by ci-deployer, so a username exemption does not reach them and they are still rejected.
DExempt the Job controller's service account, so that the build Jobs' Pods are admitted
Incorrect
The documentation says controller service accounts should generally not be exempted: it implicitly exempts any user who can create the corresponding workload resource, here every team that creates Jobs.
Exempt requests skip enforce, audit and warn entirely. Because most Pods are created by controllers, a username exemption only helps when that user creates the Pods itself, while exempting a controller service account or the whole namespace would extend the exemption to everyone who creates workloads there.
A namespace has the label pod-security.kubernetes.io/enforce=restricted and no other Pod Security labels. The team wants to make sure that a cluster upgrade cannot start rejecting its Pods just because a newer Kubernetes release tightened the Restricted profile, while still hearing about such changes early. Which change fits?
ASet enforce-version to latest and pin audit-version to the current minor release
BLeave the labels as they are, since without a version label the policy stays at the release in which the label was added
CPin enforce-version to the current minor release and add warn=restricted with warn-version latest
DAdd audit-version: latest only, because the audit version also decides which version enforce uses
Show the answer and why
ASet enforce-version to latest and pin audit-version to the current minor release
Incorrect
latest makes enforcement follow the newest policy definition, which is exactly what can start rejecting Pods after an upgrade.
BLeave the labels as they are, since without a version label the policy stays at the release in which the label was added
Incorrect
When no version is set, the default is latest, so enforcement moves with every upgrade.
CPin enforce-version to the current minor release and add warn=restricted with warn-version latest
Correct
A version label pins the policy to the definition shipped with that release, so enforcement does not change on upgrade, while warn at latest reports what the newest definition would flag.
DAdd audit-version: latest only, because the audit version also decides which version enforce uses
Incorrect
Each mode has its own version label; the audit version does not change what enforce evaluates.
Each Pod Security mode can be pinned with pod-security.kubernetes.io/<MODE>-version to the policy shipped with a given minor release, and the default is latest. Pinning enforce keeps upgrades from changing what is rejected, and a warn label at latest surfaces new violations ahead of time.
A namespace has only the label pod-security.kubernetes.io/audit=baseline. What happens when someone creates a Pod there that violates Baseline?
AThe Pod is rejected, and the rejection is written to the audit log
BThe Pod is allowed, and the user sees a warning in kubectl
CThe Pod is held in Pending until an administrator approves it
DThe Pod is allowed, and the violation is recorded as an annotation on its audit event
Show the answer and why
AThe Pod is rejected, and the rejection is written to the audit log
Incorrect
Rejection is what enforce mode does; audit mode only records.
BThe Pod is allowed, and the user sees a warning in kubectl
Incorrect
User-facing warnings come from warn mode.
CThe Pod is held in Pending until an administrator approves it
Incorrect
Pod Security admission has no approval step; each mode allows, warns, records or rejects.
DThe Pod is allowed, and the violation is recorded as an annotation on its audit event
Correct
In audit mode, violations trigger an audit annotation on the event in the audit log but are otherwise allowed.
Pod Security admission has three modes. enforce rejects violating Pods, audit records a violation as an annotation on the audit event, and warn shows the user a warning; audit and warn both let the Pod through.
PodSecurityPolicy was removed from Kubernetes in v1.25. Which built-in mechanism replaced it for enforcing Pod security restrictions?
AThe Pod Security admission controller
BNetworkPolicy
CRuntimeClass admission
DThe ResourceQuota admission controller
Show the answer and why
AThe Pod Security admission controller
Correct
The migration guide describes moving from PodSecurityPolicy to the built-in PodSecurity admission controller, which enforces the Pod Security Standards.
BNetworkPolicy
Incorrect
NetworkPolicy controls network traffic, not Pod security settings.
CRuntimeClass admission
Incorrect
The RuntimeClass admission plugin handles Pod overhead for runtime classes; it does not enforce security profiles.
DThe ResourceQuota admission controller
Incorrect
ResourceQuota limits resource consumption; it does not check security fields.
With PodSecurityPolicy gone since v1.25, Kubernetes enforces the Pod Security Standards through the built-in Pod Security admission controller, configured with namespace labels and, optionally, an admission configuration.