GKE, Using same ip or ip range for all nodes inside the cluster

3/7/2019

I setup a cluster on gke.

I also have an RDS database on AWS, this one is inside a VPC. I need to whitelist a CIDR range for access to the database from GKE.

My problem is, all my nodes on gke have a specific IP but not in the same range.

So my question is, how can I have a unique IP outside(NAT) or define a range for the allocation of ip on my node?

I have tried this solution, but it does not seem to be working, curl checkip.amazonaws.com returns the IP of my node, maybe I forgot some things...

Thanks in advance.

-- Alexandre Cys
gcloud
google-kubernetes-engine
ip
kubernetes

1 Answer

3/7/2019

Using Cloud NAT is definitely the way to go. It sounds like it you've tried this and it isn't working, but without NAT (as you've found) you won't have an easy way to provide a CIDR range (or even a stable set of IPs) to RDS. IPs for VMs come from a very wide range and if you scale your cluster up you will get new IPs that won't be in the same range as your existing IPs. Cloud NAT allows you to have a stable range from which all of your cluster traffic egresses, and you can use that for authentication to RDS.

-- Robert Bailey
Source: StackOverflow