我在 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”条消息,您的后端健康检查将被标记为健康或不健康。以下是一些官方文档这解释了这种行为。