Interview Prep/DevSecOps/Kubernetes admission control and Pod Security

Enabling `enforce=restricted` on a namespace did not evict the existing non-compliant pods

BeginnerTroubleshootingKubernetes admission control and Pod Security
Answer

Likely causes → Pod Security Admission is admission-time only; it never touches running pods. They fail only when recreated.

Diagnose → The kubectl label command printed warnings about existing pods; or dry-run it again with --dry-run=server.

Fix → Fix the workloads and roll them (kubectl rollout restart deploy -n prod) in a controlled window so you find failures now, not during a node drain at 3 a.m.

Prevent → Audit first with audit/warn labels and fix everything before enforcing.

All DevSecOps questions Roadmap: Policy as code

More on Kubernetes admission control and Pod Security