How to create region specific load balancer in GCP for kubernetics?

6/10/2018

I created a cluster in GCP Kubernetics Engine and exposed the same through a load balancer as specified in the documentation.

Used the following code:

kubectl expose deployment deployment-name --type=LoadBalancer --port 80 --target-port 8080

This worked well and provided me with an external IP. My cluster is located in asia-south1 region and placed it inside a VPC(and subnet) within the same region.

The issue is when I checked my packet hops using traceroute <load balancer ip> I found that my packets are reaching California. Seeing that I checked the location of my load balancer by IP, I found that my load balancer Ip is in California too. Why is this happening here? I expected my load balancer to sit in asia-south1 and my packets to only travel in this region? Is there anything wrong with my configuration?

My actual issue here is latency. My server code(Nodejs) finishes the execution in ~70ms, but to deliver the response to me (sitting in asia) it took ~650ms (for ~100 concurrent users). This is unacceptable.

Adding the traceroute logs here:

 1  xiaoqiang (192.168.31.1)  1.689 ms  1.208 ms  1.324 ms
 2  10.143.0.1 (10.143.0.1)  2.873 ms  8.561 ms  6.314 ms
 3  10.229.0.13 (10.229.0.13)  6.356 ms  3.581 ms  3.517 ms
 4  broadband.actcorp.in (183.82.14.221)  2.793 ms  5.884 ms  26.071 ms
 5  14.141.24.249.static-hyderabad.tcl.net.in (14.141.24.249)  6.486 ms
    14.141.24.161.static-hyderabad.tcl.net.in (14.141.24.161)  2.450 ms
    14.141.24.145.static-hyderabad.tcl.net.in (14.141.24.145)  2.870 ms
 6  * * *
 7  * * *
 8  115.113.165.98.static-mumbai.vsnl.net.in (115.113.165.98)  35.840 ms  39.332 ms  35.704 ms
 9  * * 108.170.248.161 (108.170.248.161)  39.351 ms
10  209.85.253.246 (209.85.253.246)  48.228 ms *
    209.85.251.18 (209.85.251.18)  76.367 ms
11  * * *
12  * * *
13  * * *
14  * * *
15  * * *
16  * <MY LOAD BALANCER IP>  32.129 ms *
-- vizsatiz
google-cloud-platform
google-kubernetes-engine

1 Answer

7/2/2018

IP Geo Information is maintained internally by using a variety of signals to map an IP block to a physical location within X% accuracy. This process is not guaranteed to work, and in the absence of any signals, the default is to fall back to Google Headquarters in Mountain View, California regardless of the physical location of the server to which the address is attached. More details can be found in the following link.

If you’re still experiencing the latency issue, please provide all relevant details to our support team using the Private Issue Tracker.

-- Taame Amine
Source: StackOverflow