发行:
我们在我们的功能中增加了健康检查配置。然而,由于活性和准备状态检查中的超时错误,pod变得不健康,从而重新启动。但是,如果我使用CURL或浏览器访问相同的健康检查url,它将返回正确的响应.。
健康检查配置参考。
我们正在使用Kubernetes HPAv2进行自动缩放(参考文献)。
test-function.yml
test-function:
lang: quarkus-java-with-fonts
handler: ./test-function
image: repo.azurecr.io/test-function:0.1
labels:
agentpool: openfaas
com.openfaas.scale.min: "2"
com.openfaas.scale.max: "10"
com.openfaas.scale.factor: 0
annotations:
com.openfaas.health.http.path: "/health"
com.openfaas.health.http.initialDelay: "30s"
environment:
secret_name: environment-variables
secrets:
- environment-variables
constraints:
- agentpool=openfaas
limits:
cpu: 1500m
memory: 1Gi
requests:
cpu: 500m
memory: 500Mi错误跟踪:
Liveness probe failed: Get "http://XX.XXX.XX.XX:8080/health": context deadline exceeded (Client.Timeout exceeded while awaiting headers)
Readiness probe failed: Get "http://XX.XXX.XX.XX:8080/health": context deadline exceeded (Client.Timeout exceeded while awaiting headers)知道有什么不对劲吗。
发布于 2021-08-26 07:55:11
这些错误:
Liveness probe failed: Get "http://XX.XXX.XX.XX:8080/health": context deadline exceeded (Client.Timeout exceeded while awaiting headers)
Readiness probe failed: Get "http://XX.XXX.XX.XX:8080/health": context deadline exceeded (Client.Timeout exceeded while awaiting headers)意味着HTTP请求失败。为了使这种准备和活性探测正常工作,这种请求必须是成功的。
要找出问题所在,您需要获取pod地址。运行:
kubectl get pods -o wide您应该会看到类似于以下内容的输出:
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
<my-pod-name> 1/1 Running 0 25d 10.92.3.4 <my-node-name> <none> 1/1带上你的IP然后运行:
kubectl exec -t <another_pod> -- curl -I <pod's cluster IP>如果您得到一个200响应代码,这意味着端点被正确地创建和配置。任何其他的答案都表明你的形象有问题。
另请参阅:
https://stackoverflow.com/questions/68922818
复制相似问题