"kubectl describe pod" 未报告正确的 url 活性探测

"kubectl describe pod" does not report proper url of liveness probe

以下是 运行 kubectl -n mynamespace describe pod pod1 之后的活跃度和准备情况报告:

Liveness:   http-get http://:8080/a/b/c/.well-known/heartbeat delay=3s timeout=3s period=10s #success=1 #failure=3
Readiness:  http-get http://:8080/a/b/c/.well-known/heartbeat delay=3s timeout=3s period=10s #success=1 #failure=3

  1. 这是有效的(有效的)url吗? http://:80/

  2. #success=1 #failure=3是什么意思?

结果完全正确:

  • http://:8080 表示它将在您的 pod 内的端口 8080 中尝试 http-get
  • #success=1 表示成功阈值为 1(默认值),因此它在第一次收到答案时会将 pod 标记为活动或就绪
  • #failure=3 表示失败阈值为 3(又是默认值),因此第三次调用失败将标记为未就绪或尝试重新启动。

查看官方文档:https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/#configure-probes

您可以尝试执行此命令以查看探针的配置方式:

kubectl -n mynamespace get pod pod1 -o yaml