首页 > 解决方案 > Openshift/Kubernetes 活力探针 Spring actuator

问题描述

我已经实现了弹簧执行器健康端点并将其添加到 Livelines 探针中 - http-get http://:8080/actuator/health

当我描述 pod 时,我没有看到 #success 计数器正在增加

http-get http://:8080/actuator/health delay=60s timeout=20s period=10s #success=1 #failure=3

如何知道 liveliness 探针是否真的使用默认执行器的健康端点运行

标签: springkubernetesopenshiftspring-boot-actuator

解决方案


这里的成功值是successThreshold。它不是一个计数器字段

kubectl explain pod.spec.containers.livenessProbe.successThreshold

DESCRIPTION:
     Minimum consecutive successes for the probe to be considered successful
     after having failed. Defaults to 1. Must be 1 for liveness. Minimum value
     is 1.

同样有一个失败阈值

kubectl explain pod.spec.containers.livenessProbe.failureThreshold

当一个 Pod 启动并且探测失败时,Kubernetes 会在放弃之前尝试 failureThreshold 次。在 liveness probe 的情况下放弃意味着重新启动容器。在就绪探测的情况下,Pod 将被标记为未就绪。默认为 3。最小值为 1。configure -probes


如何知道 liveliness 探针是否真的使用默认执行器的健康端点运行

检查你的 pod 的日志

kubectl logs -f $pod

或者查看 kubelet 的日志,它正在探测 pod

journalctl -f -u kubelet


推荐阅读