K8S-HTTP-503 kubernetes runtime_error ai_generated true

http: HTTP 探测失败,状态码:503

http: HTTP probe failed with statuscode: 503

ID: kubernetes/kubelet-http-healthz-fail

其他格式: JSON · Markdown 中文 · English
85%修复率
88%置信度
1证据数
2024-01-10首次发现

版本兼容性

版本状态引入弃用备注
kubernetes 1.22 active
kubernetes 1.23 active
kubernetes 1.27 active
kubernetes 1.28 active

根因分析

应用程序的 HTTP 健康检查端点返回 503 状态,通常是因为应用未准备好提供服务或过载。

English

The application's HTTP health endpoint returned a 503 status, usually because the app is not ready to serve traffic or is overloaded.

generic

官方文档

https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/

解决方案

  1. 检查应用程序日志中的启动错误或依赖项故障。例如,运行 `kubectl logs <pod-name> -c <container>` 并查找堆栈跟踪。
  2. 确保健康检查端点仅在所有依赖项(数据库、缓存)就绪时返回 200。如果应用程序需要时间初始化,请使用具有较长初始延迟的启动探测。

无效尝试

常见但无效的做法:

  1. Increase the liveness probe threshold without fixing the app. 70% 失败

    This only masks the problem; the app remains unhealthy and may crash later.

  2. Remove the readiness probe entirely. 85% 失败

    Removing the readiness probe can cause traffic to be routed to unhealthy pods, leading to user-facing errors.