Home > Software design >  GCP: Health check not working on non-80-port
GCP: Health check not working on non-80-port

Time:12-21

I'm trying to set-up a managed instance group. The instance group is to run an image in which a Node.js server is listening on port 8080.

Setting up the template and the instance group works. I can SSH into the machine. docker ps gives me the expected results. And curl localhost:8080/v1/status results in OK.

Now I tried to add a health check - and that doesn't work. It always results in a TIMEOUT. According to the logs, no request of the health check reaches the Node.js server. The logs of the health checker are not really helpful.

I triple-checked the settings in the health check. Path and port number are corrected.

I have looked at other projects with a similar setup. The only difference I spotted is the port. Those are using port 80. However, I cannot see why this should be an issue. If the port the server listens to and the port the health checker checks on are equal - then there should be no issue. But maybe I'm missing something here.

How can I debug this further? How can I see why the health check is failing? Can I add some port mapping from 8080 to 80 anywhere?

CodePudding user response:

you need to add a firewall rule for this ip ranges and add your port/instance group as a destination

Health check source ranges for gcp

  • 35.191.0.0/16
  • 130.211.0.0/22

for more information please have a look at this doc

https://cloud.google.com/load-balancing/docs/firewall-rules

  • Related