Kubernetes 探针失败的定位与修复
Pod 反复重启,Events 显示 Liveness probe failed、Readiness probe failed 或 Startup probe failed。服务可能实际已启动,但探针判断失败。
kubectl describe pod <pod> -n <ns>
kubectl logs <pod> -n <ns> --previous
kubectl get pod <pod> -n <ns> -o yaml | grep -A10 -E 'Probe:'
kubectl exec -it <pod> -n <ns> -- sh
在容器内手动验证:
curl -v http://127.0.0.1:<port>/healthz
wget -qO- http://127.0.0.1:<port>/ready
initialDelaySeconds 或 startupProbe 不足。curl/wget,exec 探针本身失败。startupProbe,并放宽 failureThreshold。kubectl — Pod、日志、事件curl — 容器内健康检查k8s 分支的 deployment 页面 — 探针配置