What would you do after finding a compromised pod in production?
AdvancedScenarioSecurity, RBAC and policy
Answer
Situation read → A crypto miner is running in a container.
What I'd do →
- Isolate: apply a deny-all NetworkPolicy or label to quarantine the pod
- Keep evidence:
kubectl logs,kubectl get pod -o yaml, node-level forensics, and snapshot the volume - Cordon the node and review other pods on it
- Rotate Secrets, ServiceAccount tokens and IAM roles it could reach
- Find the entry point (image, exposed dashboard, RBAC), fix, then rebuild from clean images
Why → Containing first preserves evidence and stops lateral movement.
Interview tip → Say "isolate, preserve, eradicate, rotate".
More on Security, RBAC and policy
A developer needs read-only access to one namespace. How do you grant it?BeginnerExplain the difference between Role, ClusterRole, RoleBinding and ClusterRoleBinding.IntermediateA CI pipeline needs to deploy to one namespace. What identity do you give it?IntermediateWhat does a ServiceAccount do and why should you disable the token automount?BeginnerHow do you let pods on EKS access S3 without static keys?IntermediateA pod has access to the node's IAM role through IMDS. How do you prevent credential theft?Advanced