How do you prevent a pod from reaching the internet but allow internal calls?
IntermediateScenarioSecurity, RBAC and policy
Answer
Situation read → Compliance forbids egress to the public internet for a batch job.
What I'd do →
- Create an egress NetworkPolicy allowing DNS and in-cluster CIDRs (
ipBlock) - Or use a private subnet without NAT route for those nodes
- Use VPC endpoints for AWS services
- Test with
curlto a public IP - Use FQDN policies with Cilium if needed
Why → Without egress policy every pod can reach anything its node can.
Interview tip → Standard NetworkPolicy cannot filter by hostname.
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