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.
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.