![GCP 负载均衡器健康检查频率非常高](https://linux22.com/image/720997/GCP%20%E8%B4%9F%E8%BD%BD%E5%9D%87%E8%A1%A1%E5%99%A8%E5%81%A5%E5%BA%B7%E6%A3%80%E6%9F%A5%E9%A2%91%E7%8E%87%E9%9D%9E%E5%B8%B8%E9%AB%98.png)
我在 GCP 上使用 HTTP 负载均衡器,通过 Kubernetes 配置入口。
看起来健康检查请求的次数非常频繁:
10.0.4.1 - - [24/Apr/2018:17:53:25 +0000] "GET / HTTP/1.1" 200 695 "-" "GoogleHC/1.0"
10.128.0.5 - - [24/Apr/2018:17:53:25 +0000] "GET / HTTP/1.1" 200 695 "-" "GoogleHC/1.0"
10.128.0.7 - - [24/Apr/2018:17:53:25 +0000] "GET / HTTP/1.1" 200 695 "-" "GoogleHC/1.0"
10.128.0.5 - - [24/Apr/2018:17:53:25 +0000] "GET / HTTP/1.1" 200 695 "-" "GoogleHC/1.0"
10.128.0.7 - - [24/Apr/2018:17:53:25 +0000] "GET / HTTP/1.1" 200 695 "-" "GoogleHC/1.0"
10.0.4.1 - - [24/Apr/2018:17:53:25 +0000] "GET / HTTP/1.1" 200 695 "-" "GoogleHC/1.0"
10.128.0.5 - - [24/Apr/2018:17:53:26 +0000] "GET / HTTP/1.1" 200 695 "-" "GoogleHC/1.0"
10.0.4.1 - - [24/Apr/2018:17:53:26 +0000] "GET / HTTP/1.1" 200 695 "-" "GoogleHC/1.0"
10.128.0.7 - - [24/Apr/2018:17:53:26 +0000] "GET / HTTP/1.1" 200 695 "-" "GoogleHC/1.0"
10.128.0.5 - - [24/Apr/2018:17:53:26 +0000] "GET / HTTP/1.1" 200 695 "-" "GoogleHC/1.0"
10.128.0.5 - - [24/Apr/2018:17:53:26 +0000] "GET / HTTP/1.1" 200 695 "-" "GoogleHC/1.0"
10.128.0.7 - - [24/Apr/2018:17:53:27 +0000] "GET / HTTP/1.1" 200 695 "-" "GoogleHC/1.0"
10.128.0.5 - - [24/Apr/2018:17:53:27 +0000] "GET / HTTP/1.1" 200 695 "-" "GoogleHC/1.0"
这是正常/预期的吗?如您所见,我用200
s 进行响应。我还检查了配置,轮询间隔应该是 60 秒:
nathan@test-k8s-201417:~$ gcloud compute health-checks describe health-check-id
checkIntervalSec: 60
我的预期是每六十秒进行一次健康检查,但我看到的却是每秒一百次!
答案1
这实际上是一种预期的行为,因为 Google 探测器实际上发送的请求比您的健康检查间隔要多。
但是,根据您设置的间隔以及是否收到“200”条消息,您的后端健康检查将被标记为健康或不健康。以下是一些官方文档这解释了这种行为。