Interview Prep/DevSecOps/Kubernetes admission control and Pod Security

Developers run `kubectl apply` and get a warning `would violate PodSecurity "restricted:latest"` but the pod is created

BeginnerTroubleshootingKubernetes admission control and Pod Security
Answer

Likely causes → The namespace has warn=restricted but enforce is baseline or unset. Warnings are informational.

Diagnose → kubectl get ns <ns> -o jsonpath='{.metadata.labels}'

Fix → Fix the fields listed in the warning now, before enforcement is raised.

Prevent → Make CI fail on PSA warnings by running kubectl apply --dry-run=server and grepping for Warning:.

All DevSecOps questions Roadmap: Policy as code

More on Kubernetes admission control and Pod Security