Migrating from PodSecurityPolicy
What you'll learn: How to transition away from the deprecated PodSecurityPolicy feature to modern Pod security mechanisms.
Why PodSecurityPolicy Is Going Away
PodSecurityPolicy (PSP) was Kubernetes' original way to enforce pod-level security controls cluster-wide, but it was deprecated in v1.21 and removed in v1.25. Why? PSPs were difficult to configure correctly, had confusing behavior when multiple policies applied, and often surprised users with unexpected failures.
Think of PSP like an old security checkpoint with complicated, overlapping rules that even security experts found hard to predict. Kubernetes replaced it with simpler, clearer alternatives.
Your Migration Path
You have two primary options:
1. Pod Security Admission (Built-in)
The native replacement you've already learned about. It uses the three-tier Pod Security Standards (privileged, baseline, restricted) and the admission controller to enforce them at the namespace level. This is the recommended path for most users.
2. Third-Party Policy Engines
Tools like OPA Gatekeeper, Kyverno, or Kubewarden offer more granular, customizable policy enforcement. Choose these when you need complex, organization-specific rules that go beyond Pod Security Standards.
Migration Steps (Conceptual)
- Audit existing PSPs - Understand what policies you currently enforce
- Map to Pod Security Standards - Determine which standard (baseline/restricted) matches each PSP's intent
- Apply labels to namespaces - Start in
warnorauditmode before enforcing - Test thoroughly - Ensure workloads still deploy correctly
- Remove PSPs - Once confident, delete the old PodSecurityPolicy objects
Key Takeaway: PodSecurityPolicy is deprecated and removed; migrate to Pod Security Admission for standard controls or third-party policy engines for advanced customization, using a phased approach to avoid disrupting running workloads.