You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Kubernetes中Quarkus Pod的就绪与存活探针因SmallRye Metrics失败

问题排查与解决方案

错误原因分析

报错strconv.Atoi: parsing "metrics": invalid syntax明确说明:kubelet尝试将字符串metrics转换为整数时失败。这是因为探针配置中错误地将路径值填写到了端口字段,或者字段名混淆,导致kubelet把/metrics(或metrics)当成端口号解析。

修正步骤

  1. 检查Pod的探针配置YAML,确保httpGet下的port和path字段正确对应:

    • port应设置为容器暴露的端口号(这里是8080)
    • path应设置为指标路径/metrics

    正确的探针配置示例:

    livenessProbe:
      httpGet:
        path: /metrics
        port: 8080
      initialDelaySeconds: 10
      periodSeconds: 5
    readinessProbe:
      httpGet:
        path: /metrics
        port: 8080
      initialDelaySeconds: 5
      periodSeconds: 3
    
  2. 排查常见配置错误:

    • 避免将path的值(/metrics)写入port字段,比如错误写法:port: "/metrics"
    • 检查字段名拼写,不要把path和port搞混
    • 如果使用命名端口,确保容器端口的name与探针port字段的名称一致,且端口值为整数
  3. 验证修复:
    修改配置后重新部署Pod,执行kubectl describe pod <你的Pod名称>查看探针事件,确认不再出现转换错误,Pod状态恢复正常。

内容的提问来源于stack exchange,提问作者Giamma

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.19 11:40:32