NAT Gateway IP for k8s cluster not reflected in pods

1/10/2019

I tried to create a NAT gateway as mentioned in the given tutorial: https://cloud.google.com/solutions/using-a-nat-gateway-with-kubernetes-engine After applying the terraform, though the NAT Gateway is created and assigned an IP, any outgoing traffic from the pods still comes as the Node's IP rather than the NAT Gateway's IP. Couldn't find any troubleshooting guide for the same. Any guidance would be appreciated.

-- Vivek S
google-cloud-platform
google-kubernetes-engine
kubernetes

1 Answer

1/11/2019

First of all you need to ensrure you GKE cluster is private since by now it only works using Kubernetes “private” clusters. If the VM instances have an external IP, the routing will be through them and not by Cloud NAT.

-- Omar G.
Source: StackOverflow