Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTTPS load balancer in Google Container Engine

I'm trying to set up an HTTPS load balancer for GKE using HTTPS L7 load balancer but for some reason is not working. Even the HTTP load balancer in the HTTP Load Balancing walkthrough. The forwarding rule's IP address is created and I'm able to ping and telnet to port 80. But when request via curl it give me a error.

<title>502 Server Error</title> </head> <body text=#000000 
bgcolor=#ffffff> <h1>Error: Server Error</h1> <h2>The server 
encountered a temporary error and could not complete your request. 
<p>Please try again in 30 seconds.</h2> <h2></h2> </body></html>

All the steps were fine and I created a firewall without any tags for the ${NODE_PORT} but it didn't work.

Has anyone encountered this problem?

like image 846
lucas.coelho Avatar asked Aug 24 '15 17:08

lucas.coelho


People also ask

What is HTTPS load balancer in GCP?

External HTTP(S) Load Balancing is a proxy-based Layer 7 load balancer that enables you to run and scale your services behind a single external IP address.

How will you create internal HTTPS load balancer in GCP?

You create the required network, subnets, and IP addresses in the host project. Then, for the load balancer components, you can do one of the following: Create the load balancer frontend and URL map in a host or service project; create the backend services and backends in multiple service projects as required.

Does Google use load balancing?

Google Cloud offers the following load balancing features: Single anycast IP address. With Cloud Load Balancing, a single anycast IP address is the frontend for all of your backend instances in regions around the world.


2 Answers

I had the same problem with my application, the problem is that we did not have an endpoint returning "Success" and the health checks were always failing.

It seems that the HTTP/HTTPS load balancer will not send the request to the cluster nodes if the health checks are not passing, so my solution was to create an endpoint that always returns 200 OK, and as soon as the health checks were passing, the LB started working.

like image 113
andresk Avatar answered Oct 21 '22 12:10

andresk


I just walked through the example and (prior to opening up a firewall for $NODE_PORT) saw the same 502 error.

If you look in the cloud console at

https://console.developers.google.com/project/<project>/loadbalancing/http/backendServices/details/web-map-backend-service

you should see that the backend shows 0 out of ${num_nodes_in_cluster} as healthy.

For your firewall definition, make sure that you set the source filter to 130.211.0.0/22 to allow traffic from the the load balancing service and set the allowed protocols and ports to tcp:$NODE_PORT.

like image 11
Robert Bailey Avatar answered Oct 21 '22 13:10

Robert Bailey