TCP Global Load balancer in GCP

Girish V P
ADIBI Technologies, Basavanagudi, Blore.
4 min readJan 11, 2019

Google Cloud Platform (GCP) TCP proxy(or Global) load balancer intelligently routes traffic to the instances that are closest to the user. The entire world you are using single IP address to access TCP Proxy Load Balancer. This type of LB is intended for non-HTTP traffic. For HTTP traffic, HTTP Load Balancing is recommended instead. For proxied SSL traffic, use SSL Proxy Load Balancing. Only limited number of ports are allowed as a listener from LB front-end. To Configure global TCP global load balancer follow the steps below.

The Experiment

We Create two Instance groups with two VMs each. One Instance group is meant for Asia and the other for Asia. So when you access from Asia, LB connects and balances the sessions within the Asia Instance group. In case they are down or overloaded then automatically connects to US Instance group and vice versa.

  1. Create health check

2) Create Instance template

3) Create two Instance Groups

4) Create TCP Global LB

4-a) Create LB Backend

4-b) Create LB Front End

  1. Create health check: Create a HTTP health check to monitor web server nodes (Refer step 1 of this document). This is different from health check you will setup later for your TCP load balancer.

2) Create Instance template: Create one Instance template which will be attached to Instance group in the next step to create multiple VMs. ( Follow this document step 2)

3) Create Instance groups: We will create two Instance group, each contain 2 VM instances. I have created Instance group in US and the other for Asia (Follow step 3 to do this)

4) Create TCP Proxy Load Balancer: Read step4 for of this document and Select TCP Load balancing this time (Instead of HTTP Load Balancing) and click Start configuration. Select option like below, and Click Continue.

4-a) Create Backend for LB: Click backend configuration and add instance group, specify port number as 80, Click done. Repeat the same step for second Instance group.

Next when click Health check, it will prompts for creating a new ( if you don't have existing one). Enter Information like below

4-b)Create Frontend for LB: Click Frontend configuration and you have to select port TCP and port 443 ( there is no 80 in this list). So in our case it is an web communication uses port TCP/443. Click done and then Create.

Test the Configuration

You have to access the Load balancer with http://public_ip_of_lb:443 . When you refresh the browser, you returns the web pages from second node of the nearest region. You stop both nodes in your nearest region. LB return the pages from one of the nodes of the second region. When you refresh the browser LB returns the pages from second node of the second region. Thus doing an Intelligent Routing. Out put of nestat command

Conclusion: We understood various steps involved in creating TCP Proxy load balancer . This experiment with 443 port may not have much practical importance, Yet it is very important to know the steps to create it along with the concepts.

Disclaimer: This experiment is accomplished in test environment. You are requested to verify your setup thoroughly before you implement in a production environment. Some of the screenshots may not reflect exactly as the original GCP web console due to mangled copying and joining of multiple screenshots to form a single one. You may have to refer the original GCP console.

--

--