A pentest finds 300 workloads running as root, many with `privileged: true`. How do you remediate without breaking production?

IntermediateScenarioSecurity incidents
Answer

Situation read → Turning on enforcement tomorrow would break deploys. Measure first, fix gradually, then enforce.

What I'd do →

  1. Label namespaces with Pod Security Admission in warn and audit mode at restricted, so you see violations without blocking anything.
kubectl label ns shop pod-security.kubernetes.io/warn=restricted \
  pod-security.kubernetes.io/audit=restricted
  1. Build a report of violations per team, and work out which privileged pods actually need it (CNI, CSI drivers, node agents). Those go in a dedicated system namespace with an exception.
  2. Fix images: add a non-root USER, make writable paths explicit (emptyDir), drop all capabilities.
  3. Give teams a secure default in the Helm chart or base Kustomize:
securityContext:
  runAsNonRoot: true
  allowPrivilegeEscalation: false
  capabilities: { drop: ["ALL"] }
  seccompProfile: { type: RuntimeDefault }
  1. Switch namespaces to enforce one by one as they go clean, and block new violations in CI with Kyverno or Conftest.

Why → Warn → fix → enforce avoids breaking production and stops the problem from growing.

Interview tip → Mention that some system components really do need privileges; blanket enforcement breaks the cluster.

All Real-World Interview questions Roadmap: Interview readiness

More on Security incidents