Your pods need a fixed outbound IP for a partner's allow list. How do you do it?
IntermediateScenarioKubernetes Networking
Answer
Situation read → Pod IPs change and node IPs vary, so egress needs a stable exit.
What I'd do →
- Route pod egress through NAT gateways with Elastic IPs, which are stable per AZ
- With the VPC CNI custom networking SNAT happens at the node; check
AWS_VPC_K8S_CNI_EXTERNALSNAT - For finer control use an egress gateway (Cilium Egress Gateway, Istio egress gateway) pinned to specific nodes with EIPs
- Provide the partner with the IPs
- Test with
kubectl run -it --rm curl --image=curlimages/curl -- curl -s ifconfig.me
Why → The source IP the partner sees is whatever NAT sits last in the path.
Interview tip → Say you verify with an external echo service.
More on Kubernetes Networking
Explain the Kubernetes networking model in one minute.BeginnerClusterIP, NodePort and LoadBalancer: when do you use each?BeginnerHow does a pod find another service by name?BeginnerService versus Ingress: what is the difference?BeginnerWhat does a CNI plugin do and which ones do you know?BeginnerHow do you reach a pod from your laptop for debugging without exposing it?Beginner