Interview Prep/DevSecOps/Kubernetes Security

You must roll out Pod Security Standards on a cluster with 80 existing namespaces. How do you avoid breaking workloads?

IntermediateScenarioKubernetes Security
Answer

Situation read → Pod Security Admission can warn and audit before it enforces. Use that.

What I'd do →

  1. Label all namespaces with warn and audit at restricted, enforce at baseline:
kubectl label ns --all \
  pod-security.kubernetes.io/enforce=baseline \
  pod-security.kubernetes.io/warn=restricted \
  pod-security.kubernetes.io/audit=restricted --overwrite
  1. Dry-run first: kubectl label --dry-run=server --overwrite ns orders pod-security.kubernetes.io/enforce=restricted lists violating pods.
  2. Fix manifests team by team (runAsNonRoot, drop capabilities, seccomp RuntimeDefault).
  3. Move namespaces to enforce=restricted once clean; keep system namespaces at privileged with a documented reason.

Why → Warnings in kubectl output and audit logs give teams time to fix things before anything is blocked.

Interview tip → PodSecurityPolicy was removed in 1.25; PSA is the built-in replacement.

All DevSecOps questions Roadmap: Supply chain, secrets & identity

More on Kubernetes Security