Am running an EKS cluster deployed on a node (in public subnet) with two namespaces, one pod running in each of the namespaces. I have created two NAT gateways on the same subnet. I would like to route egress traffic from pod A to NAT gateway A and egress traffic from pod b to NAT gateway B. Am well aware that this use case is peculiar and NAT gateways arent supposed to be used this way, but my situation calls for such a solution
My approach was to modify the pod's ip route table to add a default gateway that points to the appropriate NAT gateway's private ip. It would look something like
**For pod A**
*ip route add default via <NAT1's priv ip> dev eth0*
(Am unsure if this is even possible, how will the POD's ip namespace even know about NAT's 1 private IP)
**For pod B**
*ip route add default via <NAT2's priv ip> dev eth0*
Is there a better way to achieve routing to a specific NAT Gateway from within PODS?
Thanks Kay
0 Answers