Interview Prep/Kubernetes/Security, RBAC and policy

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 →

  1. Create an egress NetworkPolicy allowing DNS and in-cluster CIDRs (ipBlock)
  2. Or use a private subnet without NAT route for those nodes
  3. Use VPC endpoints for AWS services
  4. Test with curl to a public IP
  5. 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.

All Kubernetes questions Roadmap: Kubernetes networking, storage & scaling

More on Security, RBAC and policy