Is there a way in GCP to load balance sftp services running in GKE in different regions?

7/19/2019

I went through all the load balancing documentations and methods of GCP. Every type of load balancer I see is using a group of VMs in different regions. Load balancers are routing traffic to services running inside VMs in different regions.

I have two clusters in two different regions, both of them have an sftp deployment and service of the same name. I want to use a global load balancer to act as a frontend for these servers, and if one goes down, other should be able to serve the client requests.

I have tried using kubemci explained in this document. It works only for HTTP(S) traffic as it uses Ingress (and ingress support only HTTP/HTTPS traffics) and sftp works using TCP protocol.

The objective here is to configure a load balancer for two sftp servers running inside two GKE clusters in two different regions, any idea how to achieve this?

I am alright with any kind of service or load balancer. Keeping in mind that instances in GKE can be created and upgraded frequently in our case, so using GCE instance internal IP doesn't seem to be a viable solution.

-- Amit Yadav
google-cloud-platform
google-kubernetes-engine
load-balancing
sftp
tcp

1 Answer

7/23/2019

To Load Balance TCP traffic, you need to create L4 LB which is the service type LoadBalancer. However, services are restricted per cluster so you can't have a single service exposing pods in 2 different clusters.

To provide the type of load balancing you are looking for, I recommend using the service type NodePort (make sure both services are using the same Node Port value) and create your own Load Balancer using a GCE VM to distribute traffic between the two clusters. This overcomes the cross-cluster requirement and it avoids any possible issues when using internal Load Balancers which are regional resources (can only receive traffic from a source within the same region)

-- Patrick W
Source: StackOverflow