0

I have configured a http external load balancer on GCP and all my vm instances are healthy in backend. But when i am trying to access my server(installed on VM) from frontend static IP that is reserved at load balancer it is giving me 502 status error.

As a result of which i am unable to launch my application server using load balancer. Help me fix this issue.

Thanking you in advance.

moin8
  • 31
  • 7
  • Please add config code if you have it. – Josh Beauregard Jul 08 '20 at 12:01
  • i cannot share code here but i can share few details like 1 backend service with 3 VMs each of it in one zone under same region and 1 http frontend load balancer with health check on tcp port 80 – moin8 Jul 08 '20 at 12:24
  • Depending on the 502 message the root cause can change. Could you please provide the statusDetails of this error. You can find it in the HTTP Load Balancer Stackdriver logs. This may help to understand a bit more your scenario. – Marcel P Jul 08 '20 at 14:42

2 Answers2

0

To troubleshoot 502 response from the Load Balancer due to "failed_to_connect_to_backend." I would check the followings:

  1. Usually, "failed_to_connect_to_backend" error message indicates that the load balancer is failing to connect to backends, investigating URL map rules is also a good point to start. I would also suggest reviewing your Load Balancer's URL map to make sure that Host rules, Path matcher, and Path rules are correctly defined and comply with descriptions in this article.
  2. Also check if the backend instances are exhausting their resources, If a backend server is overwhelmed, it will refuse incoming requests, potentially causing the load balancer to give up on it and return the specific 502 error you're experiencing. Also, check the output on how many established connections are present at any one time using 'netstat' and watch command.
  3. I would also recommend testing again with the HTTP(S) request directly to the instance, request the same URL that reporting 502. You might do this test in another VM instance in your VPC network.
Neelam
  • 517
  • 4
  • 10
0

maybe you should check if the time taken for the API to return the response is exceeded the timeout that will trigger the 502. The default value is 30 seconds.

Ref: https://cloud.google.com/load-balancing/docs/backend-service#timeout-setting

Ras
  • 159
  • 2
  • 5