Interview Prep/DevSecOps/Incident Response and Governance

Falco reports a reverse shell from a pod in EKS. How do you contain it while keeping evidence?

AdvancedScenarioIncident Response and Governance
Answer

Situation read → Deleting the pod loses everything. We isolate it at the network level and capture its state.

What I'd do →

  1. Label the pod and apply a deny-all NetworkPolicy that selects that label:
    kubectl label pod api-7d9f -n prod quarantine=true
    kubectl apply -f - <<'YAML'
    apiVersion: networking.k8s.io/v1
    kind: NetworkPolicy
    metadata: {name: quarantine, namespace: prod}
    spec:
      podSelector: {matchLabels: {quarantine: "true"}}
      policyTypes: [Ingress, Egress]
    YAML
    
  2. Remove app labels so the Service stops routing to it; the ReplicaSet creates a clean replacement.
  3. Cordon the node; snapshot its volume; capture container filesystem with kubectl cp or the runtime.
  4. Check the pod's service account permissions and cloud role usage in audit logs and CloudTrail.
  5. Find the entry point (vulnerable dependency, exposed endpoint) and patch before scaling back.

Why → Relabelling detaches the pod from traffic and its controller without killing it.

Interview tip → The "remove labels so the ReplicaSet orphans it" trick impresses interviewers.

All DevSecOps questions

More on Incident Response and Governance