The Kubernetes Pod Security Standards define three cumulative profiles for pod hardening, and the built-in Pod Security Admission controller enforces them per namespace, so the practical work is choosing a profile for each namespace, rolling it out without breaking workloads and keeping exemptions tight. This guide explains what the Privileged, Baseline and Restricted profiles actually check, how the admission controller applies them through namespace labels, how version pinning and exemptions behave, and how to move a cluster from no enforcement to Restricted for most application namespaces.
It sits alongside the Kubernetes Admission Control Guide, which covers the wider admission chain and policy engines, and PodSecurityPolicy to Pod Security Admission, which covers migrating away from the removed PodSecurityPolicy API. Here the focus is the standards themselves and running them day to day. Every field name, label and metric below comes from the Kubernetes documentation source fetched in November 2026.
Key takeaways
- The Pod Security Standards define three policies that, in the words of the Kubernetes documentation, are cumulative and range from highly permissive to highly restrictive: Privileged, Baseline and Restricted.
- Baseline prevents known privilege escalations while still allowing the default, minimally specified pod. Restricted adds hardening such as non-root, dropping all capabilities, disallowing privilege escalation and an explicit seccomp profile.
- Pod Security Admission has been stable since Kubernetes v1.25. It is configured per namespace with
pod-security.kubernetes.io/<MODE>and optional<MODE>-versionlabels, where the modes areenforce,auditandwarn. - Enforce mode applies only to pod objects, not to Deployments or Jobs, while audit and warn are also applied to workload resources. A bad Deployment is accepted and then its pods fail.
- Unless the admission controller is configured otherwise, the default for every mode is
privilegedat versionlatest, which means an unlabelled namespace enforces nothing. - Exemptions by username, RuntimeClass or namespace skip all three modes. Exempting a controller service account effectively exempts anyone who can create the matching workload resource, so treat exemptions as privileged access.
The three profiles and who they are for
The Kubernetes documentation describes each profile in terms of its intended users, which is a useful starting point for deciding which namespace gets which level.
| Profile | What the documentation says it does | Intended workloads |
|---|---|---|
| Privileged | Unrestricted policy with the widest possible level of permissions; allows known privilege escalations | System and infrastructure workloads managed by privileged, trusted users |
| Baseline | Minimally restrictive; prevents known privilege escalations and allows the default pod configuration | Application operators and developers of non-critical applications |
| Restricted | Heavily restricted; follows current pod hardening best practices at some cost to compatibility | Security-critical applications and lower-trust users |
Privileged is defined by the absence of restrictions. A pod admitted under it can bypass typical container isolation, for example by using the node's host network. In identity terms, a pod that can reach host namespaces or mount the host filesystem can usually read the kubelet's credentials, other pods' projected service account tokens and any cloud credentials available to the node, so Privileged namespaces are effectively privileged identities and should be few and well owned.
The documentation also explains why there is no profile between Privileged and Baseline: privileges above Baseline tend to be very application specific, so such policies need to be defined case by case. In practice that means the handful of workloads that genuinely need more than Baseline should be isolated in their own namespaces, with a custom policy from an admission policy engine if you need finer control than the three built-in levels.
What Baseline blocks
Baseline is a list of controls that must be disallowed. In the tables, a wildcard such as spec.containers[*] means every container, and if any container fails, the whole pod fails validation. The controls cover containers, init containers and ephemeral containers alike.
| Control | Restricted fields (summary) | Allowed values |
|---|---|---|
| HostProcess | securityContext.windowsOptions.hostProcess at pod and container level | Undefined or false |
| Host namespaces | spec.hostNetwork, spec.hostPID, spec.hostIPC | Undefined or false |
| Privileged containers | securityContext.privileged | Undefined or false |
| Capabilities | securityContext.capabilities.add | Undefined, or only AUDIT_WRITE, CHOWN, DAC_OVERRIDE, FOWNER, FSETID, KILL, MKNOD, NET_BIND_SERVICE, SETFCAP, SETGID, SETPCAP, SETUID, SYS_CHROOT |
| HostPath volumes | spec.volumes[*].hostPath | Undefined |
| Host ports | ports[*].hostPort | Undefined or 0 (a known list is not supported by the built-in controller) |
| Host probes and lifecycle hooks (v1.34+) | The host field in httpGet and tcpSocket probes and lifecycle hooks | Undefined or empty string |
| AppArmor | securityContext.appArmorProfile.type, plus the legacy annotation | Undefined, RuntimeDefault or Localhost |
| SELinux | seLinuxOptions.type; seLinuxOptions.user and role | Type undefined or container_t, container_init_t, container_kvm_t, container_engine_t (since 1.31); user and role undefined |
| /proc mount type | securityContext.procMount | Undefined or Default |
| Seccomp | seccompProfile.type | Undefined, RuntimeDefault or Localhost (never Unconfined) |
| Sysctls | spec.securityContext.sysctls[*].name | Undefined or a documented safe subset that has grown by Kubernetes version |
Two details catch teams out. First, the safe sysctl list is versioned: the documentation marks entries as added in 1.27, 1.29, 1.32 and 1.37, so a pod that passes on a newer policy version can fail on an older pinned version. Second, the host probes control only exists from v1.34, so it is only evaluated when the namespace policy version is at least that release. Both are good reasons to understand version pinning, covered below, before you rely on Baseline as a fixed standard.
From an attacker's point of view, Baseline removes the most direct container escape routes: privileged mode, host namespaces, hostPath mounts and dangerous capabilities. Those map to MITRE ATT&CK techniques such as Escape to Host (T1611) and Deploy Container (T1610), where an adversary who can create pods tries to land one with host access.
What Restricted adds
Restricted includes everything in Baseline and adds the following controls.
| Control | Requirement | Notes from the documentation |
|---|---|---|
| Volume types | Every volume must be one of configMap, csi, downwardAPI, emptyDir, ephemeral, persistentVolumeClaim, projected or secret | Blocks other inline volume sources |
| Privilege escalation | allowPrivilegeEscalation must be false | Linux only from v1.25, when spec.os.name is not windows |
| Running as non-root | runAsNonRoot must be true | Container fields may be unset if the pod-level field is true |
| Running as non-root user (v1.23+) | runAsUser must not be 0 | Any non-zero value or unset |
| Seccomp (v1.19+) | Profile must be explicitly RuntimeDefault or Localhost | Both Unconfined and absence are prohibited; Linux only from v1.25 |
| Capabilities (v1.22+) | Must drop ALL; may add back only NET_BIND_SERVICE | Linux only from v1.25 |
The difference between the two profiles in practice is that Baseline accepts a pod that says nothing about its security context, while Restricted requires the pod to declare it. A typical Restricted-compliant container sets runAsNonRoot: true and seccompProfile.type: RuntimeDefault at pod level, then allowPrivilegeEscalation: false and capabilities.drop: ["ALL"] on each container. Most of the work of adopting Restricted is getting those four settings into Helm charts, operator templates and base manifests, and making sure container images actually run as a non-root user.
Windows nodes need care. The documentation notes that many pod securityContext fields have no effect on Windows, that the Restricted policy uses pod.spec.os.name from v1.25 to relax Linux-specific controls for Windows pods, and that kubelets before v1.24 do not enforce the pod OS field, so clusters with such nodes should pin Restricted to a version before v1.25. Linux pods that use user namespaces also have some fields relaxed under Baseline and Restricted; the Kubernetes User Namespaces Guide covers that interaction.
How Pod Security Admission applies the profiles
The built-in Pod Security admission controller applies the standards at namespace level when pods are created. Each namespace can set any or all of three modes, and even a different level per mode.
| Mode | Effect of a violation | Applied to workload resources? |
|---|---|---|
enforce | The pod is rejected | No, only to the resulting pods |
audit | An audit annotation is added to the event in the audit log; the request is allowed | Yes |
warn | A user-facing warning is returned; the request is allowed | Yes |
The labels follow the pattern pod-security.kubernetes.io/<MODE>: <LEVEL>, where the level is privileged, baseline or restricted, plus an optional pod-security.kubernetes.io/<MODE>-version: <VERSION>, where the version is a Kubernetes minor version or latest.
The workload resource behaviour matters for operations. Because enforce applies only to pods, kubectl apply on a Deployment that violates the enforced level succeeds, and the failure appears later as a ReplicaSet that cannot create pods. Warn mode on the same namespace returns a warning to the person or pipeline applying the Deployment, which is why the documentation's own example sets warn and audit alongside enforce. Pipelines should treat warnings from the API server as build failures for namespaces that are moving to a stricter level.
Cluster-wide defaults and exemptions live in a PodSecurityConfiguration inside an AdmissionConfiguration file passed to the API server with --admission-control-config-file. The pod-security.admission.config.k8s.io/v1 configuration needs v1.25 or later. The documented defaults are privileged for enforce, audit and warn, each at version latest. On managed services you may not control this file, so assume unlabelled namespaces are unrestricted unless your provider documents otherwise and label every namespace explicitly.
Version pinning and cluster upgrades
Each mode can be pinned to the policy as shipped with a given Kubernetes minor version. Pinning decides which controls and which allowed lists apply, independent of the cluster version. That gives two very different behaviours:
- Pinned to a version. Policy behaviour stays stable across upgrades. New controls, such as host probes in v1.34, do not start rejecting pods until you raise the pin. The trade-off is that the namespace does not pick up new protections automatically.
- Set to latest. The namespace gets new controls as soon as the cluster is upgraded. That improves coverage but can reject pods immediately after an upgrade if a newly added control catches existing manifests.
An approach that works for many teams, offered here as an NHI Mgmt Group recommendation rather than a Kubernetes requirement, is to pin enforce-version to a tested minor version and set audit-version and warn-version to latest. Audit annotations and warnings then show what the next policy version would reject, and the enforce pin is raised as part of the upgrade checklist once violations are cleared. Record the pin in the namespace onboarding standard so it does not drift silently; the Kubernetes Namespace Onboarding Checklist is a natural place for it.
Exemptions and the identity angle
Exemptions must be explicitly listed in the admission configuration, and a request that meets an exemption is ignored completely: enforce, audit and warn are all skipped. There are three dimensions.
- Usernames. Requests from an exempt authenticated or impersonated username are ignored.
- RuntimeClassNames. Pods and workload resources that specify an exempt runtime class are ignored.
- Namespaces. Pods and workload resources in an exempt namespace are ignored.
The documentation includes a caution that is really an identity governance point. Most pods are created by controllers, so exempting an end user only helps when that user creates pods directly. Exempting a controller service account, such as system:serviceaccount:kube-system:replicaset-controller, would implicitly exempt any user who can create the corresponding workload resource. In other words, an exemption granted to a non-human identity is inherited by every human and pipeline identity that can drive it.
Two further points follow from the same logic. Impersonated usernames count, so anyone with RBAC permission to impersonate an exempt user also inherits the exemption; review impersonation rights with the Kubernetes RBAC Guide. And the namespace labels themselves are the policy, so RBAC permission to update or patch namespaces is permission to weaken pod security. Restrict namespace label changes to platform administrators and the GitOps service account, and watch for label changes in audit logs.
The documentation also lists pod updates that are exempt from checks: metadata updates other than changes to the seccomp or AppArmor annotations, and valid updates to .spec.activeDeadlineSeconds and .spec.tolerations. Existing pods are not re-admitted when a label changes, which leads to the rollout pattern below.
Rolling out Baseline, then Restricted
The Kubernetes task documentation gives the building blocks for a low-risk rollout. Combined into a programme, a sensible sequence looks like this.
- Inventory namespaces and their owners. List namespaces with no enforce label using
kubectl get namespaces --selector='!pod-security.kubernetes.io/enforce'. That selector also gives you a measurable target: the count should go to zero. - Turn on visibility everywhere. The documentation suggests, as a first step, labelling all namespaces with audit and warn at a stricter level such as baseline, without setting enforce, so that namespaces not yet evaluated stay distinguishable.
- Dry run the target level.
kubectl label --dry-run=server --overwrite ns --all pod-security.kubernetes.io/enforce=baselineruns the checks against existing pods and returns violations as warnings without changing anything. When an enforce label is actually added or changed, the admission plugin also tests each existing pod and returns warnings. - Enforce Baseline on application namespaces. Fix or isolate the workloads that fail, then set enforce to baseline with audit and warn at restricted, as in the documentation's
my-baseline-namespaceexample. - Move to Restricted namespace by namespace. Clear restricted audit annotations, update charts with the four security context settings, then set
enforce=restrictedwith a pinned version. - Keep Privileged namespaces small and named. Infrastructure such as CNI agents, storage drivers and node monitoring often needs host access. Give each its own namespace, an owner and a documented reason, and label it
enforce=privilegedexplicitly rather than leaving it unlabelled.
Because labels are not retroactive for running pods, finish each step by restarting or redeploying workloads so that every running pod has actually passed admission at the new level.
Monitoring and evidence
Pod Security Admission exposes three Prometheus metrics on the API server:
pod_security_evaluations_total: the number of policy evaluations, not counting ignored or exempt requests.pod_security_exemptions_total: the number of exempt requests.pod_security_errors_total: errors that prevented normal evaluation. The documentation notes that non-fatal errors may result in the latest restricted profile being used for enforcement, so a rise here can explain unexpected rejections.
Pair the metrics with audit log analysis. Audit mode writes annotations into audit events, which gives a record of which namespaces would fail a stricter level and which identity submitted the violating request. A sustained rise in exemptions is worth investigating, as is any change to pod-security.kubernetes.io labels or to the admission configuration. The Kubernetes Audit Log Detection Guide covers collecting and alerting on those events. For assurance, a periodic report of namespaces by enforce level and version, with owners for every Privileged namespace and every exemption, is usually enough evidence for configuration management controls such as NIST SP 800-53 CM-7 (least functionality) and AC-6 (least privilege).
The built-in controller is deliberately simple: three fixed levels, namespace scope and no mutation. If you need per-workload exceptions, a known list of host ports, image or registry rules, or automatic defaulting of security context fields, the Kubernetes documentation points to ecosystem alternatives, which in alphabetical order include Kubewarden, Kyverno and OPA Gatekeeper. Many clusters run Pod Security Admission as the floor and a policy engine for everything else; the Kubernetes Admission Control Guide covers that layering.
Common failure patterns
- Unlabelled namespaces assumed safe. The documented default is privileged for every mode, so a namespace with no labels enforces nothing.
- Enforce without warn. Deployments apply cleanly and pods silently fail to schedule because enforce is not applied to workload resources.
- Exempting controller service accounts. This widens the exemption to everyone who can create Deployments, Jobs or other workloads.
- Whole namespaces exempted for one workload. A namespace exemption covers every future pod in it, including ones nobody reviewed.
- Namespace patch rights given broadly. Anyone who can relabel a namespace can downgrade it to privileged.
- Latest everywhere with no upgrade test. A new control arrives with a cluster upgrade and rejects production pods during the change window.
- Running pods never re-admitted. Labels are raised but old pods keep running with settings the new level would reject.
- Images that run as root. Manifests set
runAsNonRoot: truebut the image's default user is root, so containers fail at start rather than at admission.
Practitioner checklist
- Every namespace has an explicit
enforcelabel, and the unlabelled namespace count is tracked to zero. - Application namespaces enforce at least baseline, with audit and warn at restricted.
- Security-critical and multi-tenant namespaces enforce restricted with a pinned version.
- Privileged namespaces are listed, owned and justified, and contain only infrastructure workloads.
- The admission configuration exemption lists are reviewed quarterly, and no controller service account is exempted.
- RBAC rights to patch namespaces and to impersonate users are restricted and reviewed.
- CI treats API server warnings as failures for namespaces moving to a stricter level.
- Enforce version pins are raised as a named step in each cluster upgrade.
- Pod Security metrics and label changes are collected and alerted on.
- Base images and charts set a non-root user, drop all capabilities, disallow privilege escalation and set a RuntimeDefault seccomp profile.
Standards and references
- Kubernetes: Pod Security Standards
- Kubernetes: Pod Security Admission
- Kubernetes: Enforce Pod Security Standards with Namespace Labels
- Kubernetes: Enforce Pod Security Standards by Configuring the Built-in Admission Controller
- NIST: SP 800-53 Rev. 5 (AC-6, CM-7)
- CIS: CIS Benchmarks
- MITRE ATT&CK: T1611 Escape to Host
Related NHI Mgmt Group resources: Kubernetes Security Guide · Kubernetes Admission Control Guide · PodSecurityPolicy to Pod Security Admission · Kubernetes Service Account Token Guide