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:
- Apply a quarantine NetworkPolicy matched by a label, then label the pod:
kubectl label pod api-7f9 -n shop quarantine=true. - Remove it from service: change the label the Service and ReplicaSet select on, so the controller orphans it and starts a clean replacement.
- Cordon the node:
kubectl cordon <node>so nothing new lands next to it. - Revoke its credentials: rotate secrets it could read, and remove its cloud role trust if it used IRSA or Pod Identity.
- 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.
More on Vulnerability Management and Incident Response
What are the stages of a vulnerability management lifecycle?BeginnerHow do you build a risk-based prioritisation policy for vulnerabilities?IntermediateWhat remediation SLAs are typical by severity?BeginnerHow should a vulnerability exception (risk acceptance) process work?IntermediateHow do you patch vulnerabilities in running containers?IntermediateDependabot vs Renovate: how do they differ?Beginner