Skip to content

Pod Security Standards

Guide

PSPs are gone. Their replacement is the Pod Security Admission (PSA) controller, built into the API server since v1.25. It enforces one of three profiles per namespace: privileged, baseline, restricted.

ProfileIntentBlocks
privilegedUnrestricted — system componentsNothing
baselinePrevent known privilege escalationhostNetwork, hostPID, hostPath, privileged containers
restrictedFollow current pod-hardening best practicesMost capabilities, runAsRoot, allowPrivilegeEscalation
namespace.yaml
apiVersion: v1
kind: Namespace
metadata:
name: payments
labels:
pod-security.kubernetes.io/enforce: restricted
pod-security.kubernetes.io/enforce-version: latest
pod-security.kubernetes.io/warn: restricted
pod-security.kubernetes.io/audit: restricted

That’s it — no controller to install, nothing to deploy.

deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: api
spec:
template:
spec:
containers:
- name: api
image: ghcr.io/reetwiz/api:1.4.2
ports: [{ containerPort: 8080 }]
securityContext:
runAsNonRoot: true
runAsUser: 10001
runAsGroup: 10001
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
capabilities:
drop: ["ALL"]
seccompProfile:
type: RuntimeDefault
securityContext:
fsGroup: 10001
seccompProfile:
type: RuntimeDefault

Progressive rollout:

labels:
pod-security.kubernetes.io/enforce: baseline # week 1: prevent obvious badness
pod-security.kubernetes.io/warn: restricted # week 1: warn devs of the target
pod-security.kubernetes.io/audit: restricted # week 1: audit-log everything
# week 4:
# pod-security.kubernetes.io/enforce: restricted