我的 Pod 每次都会因为 livenessProbe 失败而重新启动,但我不明白为什么
livenessProbe:
httpGet:
host: localhost
path: /
port: 8080
scheme: HTTP
initialDelaySeconds: 30
periodSeconds: 30
successThreshold:
timeoutSeconds: 10
在集装箱上,我有200个。
bash$ curl I http://localhost:8080
HTTP/1.1 200 OK
bash$ curl I http://127.0.0.1:8080
HTTP/1.1 200 OK
Pod 事件:
活性证明失败:获取“http://localhost:8080/”:拨打 tcp 127.0.0.1:8080 连接:连接被拒绝
请帮忙
活跃度达到 200
也许它尝试使用 localhost 连接到您的主机。
尝试删除“主机”字段
关于文档:
https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/#http-probes
要连接的主机名,默认为 Pod IP。您可能想在 httpHeaders 中设置“Host”。