<p>So I have a kubernetes cluster running in Google Cloud. And from pods inside the cluster I need to access an external DB which has IP whitelisting configured. It seems that I need a static, shared IP for the cluster's outgoing traffic, what's the best approach? </p>

<p>Setting up a service IP seems irrelevant as that's for inbound traffic. I looked into <a href="https://cloud.google.com/nat/docs/overview" rel="noreferrer">Cloud NAT</a> and it seems promising, but I'm not exactly sure about how to set that up. Any docs/tutorial would be helpful, thanks!</p>

xiaolong
<p>According the <a href="https://kubernetes.io/docs/concepts/cluster-administration/networking/#google-compute-engine-gce" rel="nofollow noreferrer">docs</a> when traffic goes out of a kubernetes cluster in GKE it will get SNATed with the IP of the node. So you could whitelist the IPs of all GKE kubernetes cluster nodes.  </p>

<p><a href="https://cloud.google.com/blog/products/gcp/kubernetes-best-practices-mapping-external-services" rel="nofollow noreferrer">Here</a> is some best practices on connecting to external services from Kubernetes cluster. An <a href="https://www.google.com/search?client=safari&amp;rls=en&amp;q=accessing%20external%20db%20in%20Google%20kubernetes&amp;ie=UTF-8&amp;oe=UTF-8" rel="nofollow noreferrer">example</a> for connecting to Cloud SQL from Google Kubernetes Engine.</p>

<p>An <a href="https://cloud.google.com/nat/docs/gke-example" rel="nofollow noreferrer">example</a> setup of Cloud NAT on GKE.</p>
