6

I have created a HTTP load balancer to basically redirect from port 80 to port 8080. The server on my instance is running on port 8080. I can connect to the server directly but the LB is not able to connect to the instance, both accessing the LB's IP directly and also the health check always fails. The instance group the LB is using consist of just that single instance.

I read Google Compute Engine health checks failing and the google-address-manager is running. However, when running ip route table list local there is no routing for my LB. The user in the above question is using Network load balancing and not HTTP load balancing (as I am) so I don't know if that is related?

Or perhaps it's related to a firewall? I have added my LB's ip address to a firewall rule that allows tcp:8080

Does anybode have any idea how can I fix this? I am not experienced with debian nor gcp. Show I just try and run the route add command referenced in the above question? If so, how come the google-address-manager is not adding the route?

Thank you in advance!

Community
  • 1
  • 1
denen
  • 267
  • 4
  • 12

3 Answers3

5

You need to make sure that your port mapping on instance group is set to correct port, the 8080 in your case.

First, edit your instance group and change the port name and port to 8080: enter image description here

Then, navigate to your http backend's settings and change the default port to the port name you've configured in your instance group.

enter image description here

Finally, make sure that your firewall rules allow access on port 8080 from 0.0.0.0/0 or at least from the IP address of HTTP load balancer (130.211.0.0/22)

DoiT International
  • 2,405
  • 1
  • 20
  • 24
  • Thank you for your answer! I have however checked my settings and they are as you explained. Do you have any other idea of what I can check? – denen Feb 12 '16 at 01:04
  • I just got it to work! Instead of 130.211.0.0/22 I had my LB public IP in the firewall rule. How come I should add 130.211.0.0/22 and not my LB's IP? Thank you so much! :-D – denen Feb 12 '16 at 02:51
4

I had the same issue and fixed it by adding a firewall rule for the health checker (which is not the same IP as your LB!). See https://cloud.google.com/compute/docs/load-balancing/health-checks?hl=en_US#http_and_https_load_balancing for instructions.

jbarham
  • 140
  • 5
  • Okay guys, this saved my life. Everything is working for me now. Apparently health checks must first be passing before any traffic is allowed into the instance. https://stackoverflow.com/questions/32188284/https-load-balancer-in-google-container-engine I'm actually quite surprised why this wasn't set up for us by default. – geoyws Oct 24 '18 at 07:05
0

In my case, I did not configure the HTTP health check correctly.

I used "/" as path, but on my backend, "/" redirects to a login-page (HTTP 301), which responds with a HTTP 200.

The health check does not follow a redirect, every HTTP response code != 200 is assumed unhealthy (from Debugging Health Checks in Load Balancing on Google Compute Engine).

So, I changed my path to "/login", this fixed my issue.

Markus Schulte
  • 4,171
  • 3
  • 47
  • 58