Pod Security Standards (PSS) replaced the deprecated PodSecurityPolicy in Kubernetes 1.25. They define three levels of security restrictions for pods.

The Three Levels

Privileged

No restrictions. Use only for system-level workloads that require full access.

Baseline

Prevents known privilege escalations. Suitable for most workloads.

Restrictions include:

Restricted

Heavily restricted. Best for security-critical applications.

Additional restrictions:

Enabling Pod Security Standards

Apply labels to namespaces:

YAML
apiVersion: v1
kind: Namespace
metadata:
  name: production
  labels:
    pod-security.kubernetes.io/enforce: restricted
    pod-security.kubernetes.io/audit: restricted
    pod-security.kubernetes.io/warn: restricted
Click to expand and view more

Modes

Migration Strategy

  1. Start with warn mode to identify violations
  2. Fix workloads to comply with standards
  3. Enable audit mode to track in logs
  4. Finally enable enforce mode

Example Compliant Pod

YAML
apiVersion: v1
kind: Pod
metadata:
  name: secure-pod
spec:
  securityContext:
    runAsNonRoot: true
    seccompProfile:
      type: RuntimeDefault
  containers:
  - name: app
    image: myapp:latest
    securityContext:
      allowPrivilegeEscalation: false
      capabilities:
        drop: ["ALL"]
      readOnlyRootFilesystem: true
Click to expand and view more

Pod Security Standards provide a standardized way to enforce security across your cluster.

Start searching

Enter keywords to search articles

↑↓
ESC
⌘K Shortcut