Interview Prep/DevSecOps/Kubernetes Security

A pod needs to bind to port 80 and the team added `NET_ADMIN` and `SYS_ADMIN` capabilities. What do you suggest?

BeginnerScenarioKubernetes Security
Answer

Situation read → Binding to a low port needs at most NET_BIND_SERVICE. SYS_ADMIN is close to full root.

What I'd do →

  1. Change the app to listen on 8080 and map port 80 in the Service.
  2. If it truly must bind 80, use only NET_BIND_SERVICE:
securityContext:
  runAsNonRoot: true
  allowPrivilegeEscalation: false
  capabilities: { drop: ["ALL"], add: ["NET_BIND_SERVICE"] }
  1. Block SYS_ADMIN and NET_ADMIN through PSA restricted or a policy.

Why → Services already remap ports; capabilities should never be the workaround.

Interview tip → "Drop ALL, add back only what you need" is the line to say.

All DevSecOps questions Roadmap: Supply chain, secrets & identity

More on Kubernetes Security