Enforcement — reject non-compliant Pods at admission.
1apiVersion: v12kind: Namespace3metadata:4 name: production5 labels:6 pod-security.kubernetes.io/enforce: restricted7 pod-security.kubernetes.io/enforce-version: latest8---9apiVersion: v110kind: Pod11metadata:12 name: compliant-pod13 namespace: production14spec:15 securityContext:16 runAsNonRoot: true17 seccompProfile:18 type: RuntimeDefault19 containers:20 - name: app21 image: nginx:latest22 securityContext:23 allowPrivilegeEscalation: false24 capabilities:25 drop:26 - ALL
1kubectl apply -f non-compliant.yaml 2>&1 | grep Warning2kubectl get events -n production --field-selector reason=FailedCreate
Modes: enforce (reject), audit (log), warn (show).