Pod Security Standards and admission
Why a permitted request can still fail
The bookstore developer may have permission to create Pods, yet the cluster can reject a proposed configuration. Admission checks applicable API operations after authentication and authorization. A policy can prevent risky configurations before a container starts. It does not replace RBAC, network isolation or runtime verification.
identity → permission → admission → persistence → scheduling → runtimeThree levels, different goals
Privileged is the unrestricted profile of the standard, not an instruction to run privileged containers. Baseline blocks common high-risk settings while retaining broad compatibility. Restricted adds stricter requirements, including non-root operation and reduced Linux capabilities. Choose a policy based on workload needs; avoid broad exemptions. The standard also checks fields not covered by this chapter’s small model.
book catalog: target Restrictedlegacy migration: evaluate Baseline plus Restricted warningsNamespace policy modes and versions
Pod Security Admission is a built-in mechanism for applying the standards. Enforce rejects nonconforming Pods; warn informs the requesting client; audit adds evidence to audit events when auditing is configured. Each mode can use its own level and minor version. Pinning a minor makes intended checks explicit; latest may change at upgrade. This fictional namespace uses v1.35 for an illustrative version lane, not a verified server version.
apiVersion: v1kind: Namespacemetadata: name: book-security-lab labels: pod-security.kubernetes.io/enforce: baseline pod-security.kubernetes.io/enforce-version: v1.35 pod-security.kubernetes.io/warn: restricted pod-security.kubernetes.io/warn-version: v1.35 pod-security.kubernetes.io/audit: restricted pod-security.kubernetes.io/audit-version: v1.35 bytemind.example.invalid/policy-lab: 'true'Compare two configurations
The catalog fixture declares non-root execution, a default seccomp profile, no privilege escalation and dropping all capabilities. The variant omits the drop list, which violates the Restricted capability requirement even when no capability is explicitly added. Under the illustrated Baseline enforce and Restricted warn/audit combination, this particular change is not by itself a Baseline violation. Other admission checks may still reject either object. These static files use an image that cannot be pulled.
name: catalogimage: registry.example.invalid/book/catalog:fixturesecurityContext: allowPrivilegeEscalation: false readOnlyRootFilesystem: trueresources: requests: cpu: 50m memory: 32Mi limits: cpu: 200m memory: 64MivolumeMounts:- name: scratch mountPath: /tmpWorkload templates and existing Pods
Warning and auditing can evaluate Pod templates of supported controllers, whereas enforcement applies to the actual Pod creation. A Deployment can therefore be accepted while its ReplicaSet cannot create Pods. Changing namespace enforcement does not automatically terminate existing nonconforming Pods. Review controller events and plan a controlled replacement after remediation.
Deployment accepted → ReplicaSet attempts Pod creation → admission rejects Pod → rollout stallsPractice a safe transition
Start by recording warning and audit findings in a disposable environment. Fix workloads, including init and ephemeral containers where applicable, then test on a version-matched approved cluster before a reviewed enforcement change. Never exempt the entire namespace as a quick fix. A negative fixture is for inspection only. Compare the two YAML files and explain the expected outcome for each policy mode.
lab-fixtures/workload-security/namespace.yamllab-fixtures/workload-security/catalog-missing-drop.yamlCheck Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Pod Security Standards and admission — knowledge check
Interpret synthetic workload security evidence.
What does enforce mode do for a violating Pod?
Which profile adds non-root and capability-drop restrictions?
What does a version label pin?
A Deployment is accepted but Pod creation violates enforce. What can happen?
Does changing enforce automatically remove existing violating Pods?