How do you assign Pod Security Admission levels across namespaces in production?
BeginnerProductionKubernetes Security Posture
Answer
restricted for all application namespaces, baseline only where a documented need exists, privileged only for system namespaces (CNI, CSI drivers, node agents).
kubectl label ns payments \
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
Set the labels through the namespace provisioning template, and use a Kyverno policy to stop teams from relabelling their namespace to privileged. Pin enforce-version if you want upgrades to never tighten rules unexpectedly.
More on Kubernetes Security Posture
What is your security baseline for a new production EKS cluster?IntermediateDraw the layered security controls for workloads on Kubernetes.BeginnerKyverno, OPA Gatekeeper or ValidatingAdmissionPolicy: how do you choose?IntermediateShow a ValidatingAdmissionPolicy that blocks containers without resource limits.AdvancedHow do you roll out default-deny NetworkPolicies in a running production cluster?IntermediateFalco or Tetragon for runtime security: how do you choose and run it?Advanced