Interview Prep/DevSecOps/Kubernetes admission control and Pod Security

Kyverno mutate policy that adds default `securityContext` does not apply to pods created before the policy existed

BeginnerTroubleshootingKubernetes admission control and Pod Security
Answer

Likely causes → Mutating admission only runs on create/update requests. Existing objects are unchanged.

Diagnose → Check pod creationTimestamp vs policy creation; kubectl get pod -o yaml | grep -A5 securityContext.

Fix → Restart workloads to pass them through admission, or use mutateExistingOnPolicyUpdate: true for supported targets (not for immutable pod fields).

Prevent → Prefer fixing manifests in Git; mutation is a safety net, not the source of truth.

All DevSecOps questions Roadmap: Policy as code

More on Kubernetes admission control and Pod Security