Kubernetes 活跃度探针活跃度

问题描述 投票:0回答:1

我的 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

kubernetes containers kubectl livenessprobe
1个回答
0
投票

也许它尝试使用 localhost 连接到您的主机。
尝试删除“主机”字段

关于文档:
https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/#http-probes
要连接的主机名,默认为 Pod IP。您可能想在 httpHeaders 中设置“Host”。

© www.soinside.com 2019 - 2024. All rights reserved.