我正在为为spring引导服务服务的kubernetes部署配置启动/活性/就绪探测。在春季引导文档中,最佳实践是使用相应的活跃度&就绪执行器端点,如下所述:https://spring.io/blog/2020/03/25/liveness-and-readiness-probes-with-spring-boot
你用什么做你的启动探针?您对failureThreshold、延迟、期间和超时值的建议是什么?在向现有设置部署isito侧雷达时,遇到了问题吗?
发布于 2022-06-01 22:08:41
我使用路径/actuator/health/readiness和/actuator/health/liveness:
readinessProbe:
initialDelaySeconds: 120
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 5
failureThreshold: 3
httpGet:
scheme: HTTP
path: /actuator/health/readiness
port: 8080
livenessProbe:
initialDelaySeconds: 120
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 5
failureThreshold: 3
httpGet:
scheme: HTTP
path: /actuator/health/liveness
port: 8080对于建议,它实际上取决于您的需求和策略( https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/ )
这方面没有任何问题:)
不要忘记激活属性中的端点(cf https://www.baeldung.com/spring-liveness-readiness-probes):
management.endpoint.health.probes.enabled=true
management.health.livenessState.enabled=true
management.health.readinessState.enabled=true发布于 2022-11-17 13:50:48
除了@B猜测答案和部分:
对于建议,这取决于您的需要和政策。
我们的一些微服务与笨重/慢的容器通信,这些容器需要时间来启动,因此我们必须使用启动探针来保护它们。https://kubernetes.io/推荐的方法是使用活动端口,与弹簧引导执行器端点的连接会产生以下结果:
readinessProbe:
httpGet:
path: /actuator/health/readiness
port: http
periodSeconds: 5
livenessProbe:
httpGet:
path: /actuator/health/liveness
port: http
periodSeconds: 5
startupProbe:
httpGet:
path: /actuator/health/liveness
port: http
failureThreshold: 25
periodSeconds: 10上述设置确保在应用程序完全启动时探测liveness和readiness (有10*25=250秒)。正如医生所说:
如果配置了这样的探测,它将禁用活性检查和准备状态检查,直到成功为止,确保这些探测不会干扰应用程序启动。
请注意,在Kubernetes中运行的应用程序不需要management.endpoint.health.probes.enabled=true (文档)。
只有当应用程序在Kubernetes环境中运行时,才会自动启用这些健康组。您可以使用
management.endpoint.health.probes.enabledconfiguration属性在任何环境中启用它们。
因此,如果您想要检查探针,例如本地的,您就需要它。
https://stackoverflow.com/questions/72467798
复制相似问题