How to allow nodes of one GKE cluster to connect to another GKE

2/12/2020

I have a GKE clusters setup, dev and stg let's say, and wanted apps running in pods on stg nodes to connect to dev master and execute some commands on that's GKE - I have all the setup I need and when I add from hand IP address of the nodes all works fine but the IP's are changing,

so my question is how can I add to Master authorised networks the ever-changing default-pool IPs of nodes from the other cluster?


EDIT: I think I found the solution, it's not the node IP but the NAT IP I have added to authorized networks, so assuming I don't change those I just need to add the NAT I guess, unless someone knows better solution ?

-- CptDolphin
google-cloud-platform
google-kubernetes-engine
kubernetes

2 Answers

2/12/2020

I'm not sure that you are doing the correct things. In kubernetes, your communication is performed between services, that represents deployed pods, on one or several nodes.

When you communicate with the outside, you reach an endpoint (an API or a specific port). The endpoint is materialized by a loadbalancer that routes the traffic.

Only the kubernetes master care about the node as resources (CPU, memory, GPU,...) provider inside the cluster. You should never have to directly reach the node of a cluster without using the standard way.

Potentially you can reach the NodePort service exposal on the NodeIP+servicePort.

-- guillaume blaquiere
Source: StackOverflow

2/14/2020

What you really need to do is configure the kubectl in jenkins pipeline to connect to GKE Master IP. The master is responsible for accepting your commands (rollback, deployment, etc). See Configuring cluster access for kubectl

The Master IP is available in the Kubernetes Engine console along with the Certificate Authority certificate. A good approach is to use a service account token to authenticate with the master. See how to Login to GKE via service account with token.

-- Shawlz
Source: StackOverflow