2
votes

I am new to Google Compute Engine and I have a hard time finding the documentation that can possible explain the behavior I am seeing.

I have setup a simple configuration for my project right now. I have 1 VM running my UI (nodejs) 1 VM running an API layer (java tomcat) 1 Cloud SQL database

I set up 2 Instance groups: 1. UI which has the only UI VM 2. API which has the only API VM

I then setup a HTTP Load balancer with a couple of simple rules to routes requests to either the UI or the API instance groups

the issue I am having is that when I restart the UI VM and it reloads and runs the startup scripts which correctly start up all my services ( i verified this ) the load balancer keeps reporting the UI backend service as down.

What's interesting is that if I use the direct IP of my UI VM I get my UI load on port 80 just like it's supposed to. However the load balancer keeps reporting it as down. I can't seem to figure out in the documentation what I am doing wrong.

Something to note: I have the UI VM configured with a ephemeral IP which basically changes every time the VM is restarted. However, the load balancer is not configured by IPs its configured by proving the VM Instance Group so it should not care about the changed IP because the VM Instance group always knows what VMs it has.

Can someone explain to me where my configuration is wrong?

1
So I went ahead and configured my VM instance with a static IP and the load balancer magically recognized my VM as online and now the HTTP load balancing rules work fine. So is that the issue I am having? Are VM instances which are to be used in the load balancer MUST be configured with static IP?DKhanaf
Is this still an issue?Kamran
This is still an issue. What I see happening now, is I made a fresh deploy to my VM, restarted the VM and now, the load balancer is saying the VM backend is unhealthy. However, when I use the static ip to directly curl my VM and it works perfectly fine.DKhanaf
VM does not need to have static IP to be considered healthy. For a health check to be deemed successful, the backend must return a valid HTTP response with code 200 within the timeoutSec period. I have a couple questions: 1- what OS are you using? 2- did you try the simple web server example from the Node.js official website to see if the problem is not from your node.js server code? 3- what port your node.js is listening to? your healthcheck has to monitor the backend servers on the same port or a different port which return 200 OK response.Kamran
It's not a problem with my application because my application is up . I can hit my application by using the actual external IP of my VM and my site loads perfectly fine. However, when I try to use the DNS name (or the external ip ) of the HTTP load balancer it does NOT route correctly to my application. And in the console the HTTP load balancer shows my application route as unhealthy. Even though it is healthy. If I manually execute the health check (it just hits the root path / every 5 seconds) it's fine. I use ubuntu server 14.10.DKhanaf

1 Answers

1
votes

Please make sure you setup firewall rule that permits traffic from the load balancing service. To do this, you'll add a firewall rule that permits HTTP and HTTPS traffic from 130.211.0.0/22, which is the HTTP(S) load balancing health check IP range. https://cloud.google.com/compute/docs/load-balancing/http/cross-region-example