# evidence-capture / kubernetes / t0 "Quick start" # # A network policy that cuts every pod labelled quarantine=true off from all # traffic, in and out. Put it in place before an incident, in each namespace # you run workloads in: # kubectl apply -n -f quarantine.yaml # # During an incident, keep the compromised pod running and cut it off: # kubectl label pod -n app- # out of its controller; a replacement starts # kubectl label pod -n quarantine=true # this policy now applies # kubectl cordon # nothing new lands beside it # kubectl get pod -n -o yaml > pod.yaml # save its definition # # Replace app with whatever label your deployment selects on. # # Verify: # From the quarantined pod, any outbound connection times out, and nothing # can reach it. # # This only works if the cluster's network plugin enforces network policies. # Check that before relying on it. --- apiVersion: networking.k8s.io/v1 kind: NetworkPolicy metadata: name: quarantine spec: podSelector: matchLabels: quarantine: "true" # Both directions listed, with no rules under either, means nothing is # allowed in or out. policyTypes: - Ingress - Egress