K8s by Example: Pod Security Standards
| Pod Security Standards (PSS) replace the deprecated PodSecurityPolicy. They define three security levels: Privileged (unrestricted), Baseline (prevent known escalations), Restricted (hardened). Enforce via namespace labels without installing additional controllers. |
| namespace-baseline.yaml | |
| Apply security standards via namespace labels. The | |
| Three modes: | |
| security-levels.yaml | |
| Privileged: No restrictions. Use for system components that need full access (CNI plugins, monitoring agents). | |
| Baseline: Prevents known privilege escalations. Reasonable default for most workloads. Blocks hostNetwork, privileged, and dangerous capabilities. | |
| Restricted: Maximum security. Requires non-root, drops all capabilities, read-only root filesystem. Use for sensitive workloads. | |
| pod-baseline-compliant.yaml | |
| A baseline-compliant pod. No hostNetwork, no privileged mode, no dangerous capabilities. Most applications work with baseline. | |
| pod-restricted-compliant.yaml | |
| A restricted-compliant pod. Runs as non-root, drops all capabilities, uses seccomp. This is the most secure configuration. | |
| terminal | |
| When a pod violates the policy, it’s rejected with a clear error message explaining which fields are non-compliant. | |
| Use | |
| terminal | |
| Audit which namespaces have security policies. Namespaces without labels default to privileged (no restrictions). | |
| Apply baseline to all new namespaces by default using an admission controller or GitOps policy. | |
| exemptions.yaml | |
| Some system components need exemptions. Configure the API server with | |
Index | Use arrow keys to navigate