Interview Prep/DevSecOps/Vulnerability Management and Incident Response

How do you contain a compromised pod without destroying evidence?

AdvancedConceptVulnerability Management and Incident Response
Answer

Deleting the pod destroys memory, processes and filesystem changes. Instead:

  1. Apply a quarantine NetworkPolicy matched by a label, then label the pod: kubectl label pod api-7f9 -n shop quarantine=true.
  2. Remove it from service: change the label the Service and ReplicaSet select on, so the controller orphans it and starts a clean replacement.
  3. Cordon the node: kubectl cordon <node> so nothing new lands next to it.
  4. Revoke its credentials: rotate secrets it could read, and remove its cloud role trust if it used IRSA or Pod Identity.
  5. Collect evidence: kubectl logs, kubectl get pod -o yaml, a container checkpoint or node disk snapshot, Falco and audit logs.

Then rebuild from a known-good image and investigate the entry point.

All DevSecOps questions Roadmap: Security in the pipeline

More on Vulnerability Management and Incident Response