问题描述
在使用 minikube 在 Kubernetes 上部署微服务时,我遇到了 Liveness 探测失败的问题。基于此答案,我将 liveness 探测器的 timeoutSeconds 从 1 更改为 10,但问题并未解决。 Readiness probe failed: timeout: failed to connect service ":8080" within 1s
错误说,
Liveness probe Failed: timeout: Failed to connect service ":8080" within 1s
Back-off restarting Failed container.
我还能做些什么来解决这个问题?
解决方法
我通过增加超时时间和添加 startupProbe 来修复它:
readinessProbe:
initialDelaySeconds: 5
timeoutSeconds: 3
successThreshold: 1
failureThreshold: 3
periodSeconds: 5
exec:
command: ["/bin/grpc_health_probe","-addr=:8080"]
livenessProbe:
initialDelaySeconds: 15
#timeoutSeconds: 3
periodSeconds: 5
successThreshold: 1
failureThreshold: 3
exec:
command: ["/bin/grpc_health_probe","-addr=:8080"]
startupProbe:
exec:
command: [ "/bin/grpc_health_probe","-addr=:8080" ]
failureThreshold: 30
periodSeconds: 10