Interview Prep/DevSecOps/Certificates, TLS and security incident response

A running pod is confirmed to be mining crypto. The team wants to `kubectl delete` it immediately

AdvancedTroubleshootingCertificates, TLS and security incident response
Answer

Likely causes → Not a cause question. The risk is destroying the evidence you need to find the entry point, and the controller simply recreating the same compromised pod.

Diagnose → Capture the evidence before changing anything:

kubectl get pod miner-x -o yaml > pod.yaml
kubectl logs miner-x --all-containers > logs.txt
kubectl get pod miner-x -o jsonpath='{.status.containerStatuses[*].imageID}'

Fix → Contain without deleting. Apply a deny-all NetworkPolicy matching a quarantine label, remove the pod from Service selectors (relabel it), and cordon the node. Snapshot the node's volume, or capture memory and the filesystem with your forensics tooling. Scale the owner to zero, and only then delete. Rotate every secret the pod could access.

Prevent → Keep an IR runbook with these commands ready, a pre-created quarantine NetworkPolicy, and drill it.

All DevSecOps questions

More on Certificates, TLS and security incident response