access database from different environment in GCP

1/14/2020

I am still new to GCP/GKE networking.

I have a mysql database located in environment A, in region east4, subnet subent-1. I need to access that database from environment B in region east4, subnet subnet-2 by private ip address.

My application is running in one of the Pods in the cluster in environment B. The cluster is assigned to subnet-2.

I set up VPC native for each environment and the two networks are connected through "vpc peering".

Any suggestions to approach to this will be greatly appreciated.

won

-- WONMAN LEE
gke-networking
google-kubernetes-engine

1 Answer

1/14/2020

Actually, there is no way to communicate Pods (services) using Private IP Address to another cluster without exposing the service , instead of this, you can do the following options.

The first one could use the Public IP's of the clusters and perform the VPC peering (A->B and B->A) to establish the complete communication.

Another option could be exposing your pod (service) and try to communicate with cluster B, using Public IP's and a Load Balancer Layer7.

-- blueboy1115
Source: StackOverflow