Pod Security Standards (PSS) define three levels of security policies
SKILL.md
Implementing Kubernetes Pod Security Standards
Overview
Pod Security Standards (PSS) define three levels of security policies -- Privileged, Baseline, and Restricted -- enforced by the Pod Security Admission (PSA) controller built into Kubernetes 1.25+. PSA replaces the deprecated PodSecurityPolicy and provides namespace-level enforcement with three modes: enforce, audit, and warn.
When to Use
Deciding whether a namespace or workload belongs at Privileged, Baseline, or Restricted
Auditing which existing workloads would be rejected if Restricted were enforced today
Translating a "must meet Restricted" requirement into concrete securityContext changes
Planning a PodSecurityPolicy migration and predicting what will break before it does
Mapping pod security posture to a compliance control (NIST PR.PS-01, CIS Kubernetes)
Not this skill: configuring the controller that enforces these profiles — namespace
labels, AdmissionConfiguration, exemptions, or debugging a pod PSA rejected. Use
implementing-pod-security-admission-controller.
Prerequisites
Kubernetes cluster 1.25+ (PSA GA)
kubectl configured with cluster-admin access
Understanding of Linux capabilities and security contexts
Core Concepts
Three Security Profiles
Profile
Purpose
Restrictions
Privileged
Unrestricted, system workloads
None
Baseline
Prevents known escalations
No hostNetwork, hostPID, hostIPC, privileged containers, dangerous capabilities
Restricted
Hardened best practices
Non-root, drop ALL caps, seccomp required, read-only rootfs recommended
# Test what would happen with restricted enforcement
kubectl label --dry-run=server --overwrite namespace my-namespace \
pod-security.kubernetes.io/enforce=restricted
# Example output:
# Warning: existing pods in namespace "my-namespace" violate the new
# PodSecurity enforce level "restricted:latest"
# Warning: nginx-xxx: allowPrivilegeEscalation != false,
# unrestricted capabilities, runAsNonRoot != true, seccompProfile
Baseline Profile Restrictions
Control
Restricted
Requirement
HostProcess
Must not set
Pods cannot use Windows HostProcess
Host Namespaces
Must not set
No hostNetwork, hostPID, hostIPC
Privileged
Must not set
No privileged: true
Capabilities
Baseline list only
Only NET_BIND_SERVICE, drop ALL for restricted
HostPath Volumes
Must not use
No hostPath volume mounts
Host Ports
Must not use
No hostPort in container spec
AppArmor
Default/runtime
Cannot set to unconfined
SELinux
Limited types
Only container_t, container_init_t, container_kvm_t
/proc Mount Type
Default only
Must use Default proc mount
Seccomp
RuntimeDefault or Localhost
Must specify seccomp profile (restricted)
Sysctls
Safe set only
Limited to safe sysctls
Validation Commands
# Verify namespace labels
kubectl get ns --show-labels | grep pod-security
# Test pod creation against policy
kubectl run test-pod --image=nginx --namespace=production --dry-run=server
# Check for violations in audit logs
kubectl get events --field-selector reason=FailedCreate -A
# Scan with Kubescape for PSS compliance
kubescape scan framework nsa --namespace production