简体   繁体   English

GCP:健康检查不适用于非 80 端口

[英]GCP: Health check not working on non-80-port

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.实例组将运行一个图像,其中 Node.js 服务器正在侦听端口 8080。

Setting up the template and the instance group works.设置模板和实例组工作。 I can SSH into the machine.我可以 SSH 进入机器。 docker ps gives me the expected results. docker ps给了我预期的结果。 And curl localhost:8080/v1/status results in OK . curl localhost:8080/v1/status结果为OK

Now I tried to add a health check - and that doesn't work.现在我尝试添加健康检查 - 但它不起作用。 It always results in a TIMEOUT .它总是导致TIMEOUT According to the logs, no request of the health check reaches the Node.js server.根据日志,健康检查的请求没有到达Node.js服务器。 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.那些正在使用端口 80。但是,我不明白为什么这应该是一个问题。 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?我可以在任何地方添加一些从 8080 到 80 的端口映射吗?

you need to add a firewall rule for this ip ranges and add your port/instance group as a destination您需要为此 ip 范围添加防火墙规则并将您的端口/实例组添加为目标

Health check source ranges for gcp gcp 的健康检查源范围

  • 35.191.0.0/16 35.191.0.0/16
  • 130.211.0.0/22 130.211.0.0/22

for more information please have a look at this doc有关更多信息,请查看此文档

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM