Sunil kumar
Sunil kumar

Reputation: 255

Error: Server Error The server encountered a temporary error and could not complete your request. Please try again in 30 seconds.(GCP)

I've configured a HTTP(S) Load balancer as per the documentation on https://cloud.google.com/compute/docs/load-balancing/http/

When I try to access the site via the Public IP address associated with the Load balancer. I'm getting a 502 response with the message:

Error: Server Error

The server encountered a temporary error and could not complete your request.

Please try again in 30 seconds.

I believe this is coming from the load balancer.

Anyone have any insight into what might be going on, what more I should be looking at?

Upvotes: 19

Views: 83708

Answers (5)

Steve Shen
Steve Shen

Reputation: 1

Check your billing at https://console.cloud.google.com/ Might as well be a billing issue.

Upvotes: 0

Kavindu Chamith
Kavindu Chamith

Reputation: 142

I had the same issue with my ingress. Found out that it was related to the health check issue mentioned in the answers.

By default, GKE would create the health check endpoints for the / (root) paths. If your service resides in a subpath (e.g. /pingpong) then the health check endpoint was not created.

I have edited the / root path to /pingpong, the subpath which I needed to expose via the Ingress in the corresponding service.

Access the health checks via this URL. https://console.cloud.google.com/compute/healthChecks

enter image description here

Upvotes: 0

Mehrdad
Mehrdad

Reputation: 71

I had the same problem. After a day of searching, it was a health checker problem. The health test was on TCP, I changed it to HTTP, the problem was solved.

Upvotes: 5

Serhii
Serhii

Reputation: 4471

Have a look at the documentation Troubleshooting HTTP(S) Load Balancing section Unexplained 502 errors:

If 502 errors persist longer than a few minutes after you complete the load balancer configuration, it's likely that either:

To verify that health check traffic reaches your backend VMs, enable health check logging and search for successful log entries.

To create an ingress rule that allows traffic from the Google Cloud health checking systems (130.211.0.0/22 and 35.191.0.0/16) you can use Cloud Console or this command:

gcloud compute firewall-rules create fw-allow-health-check \
    --network=default \
    --action=allow \
    --direction=ingress \
    --source-ranges=130.211.0.0/22,35.191.0.0/16 \
    --target-tags=allow-health-check \
    --rules=tcp

In this command target tag allow-health-check used to identify VMs.

Upvotes: 7

Jim Kay
Jim Kay

Reputation: 91

Could it be that the load balancer depends on you using the URL and not an IP address?

There are a couple of reasons that might be the case.

  1. The URL points to the load balancer and the load balancer has a list of server IP addresses that service that URL; then it picks a server and forwards the request. To do that, it must receive the oritinal URL because the load balancer may be serving multiple sets of servers.
  2. If the IP address points to the load balancer, it won't know which set of servers to choose from. If the IP address points to a server, the load balancer will be bypassed.

That's as much as I can think of... Jam

Upvotes: 0

Related Questions