解决 Cilium Hubble 报错 Hubble Relay connection refused: TLS expired 证书过期修复
排查 Hubble UI 与 CLI 无法查看网络拓扑流,报 rpc error: code = Unavailable desc = connection error: TLS certificate expired,分析 mTLS 证书轮转与 Secret 重建。
问题现象
运行 hubble status 或打开 Hubble Web UI 时提示连接中断:
Failed to connect to Hubble Relay: rpc error: code = Unavailable desc = connection error: desc = "transport: authentication handshake failed: x509: certificate has expired or is not yet valid"
触发根因
- Cilium 自动为 Hubble Relay 和各个节点 Agent 签发的内部通信 mTLS 证书已满 1 年或 3 年有效期;
- 集群内部证书自动轮转未开启或 CronJob 执行失败。
解决步骤
使用 Cilium CLI 工具一键强制轮转 Hubble 证书
执行官方更新命令:
cilium hubble disable
cilium hubble enable --ui
或者删除旧证书 Secret 触发控制器重新自动签发
清理过期证书:
kubectl delete secret -n kube-system hubble-relay-client-certs hubble-server-certs
kubectl rollout restart deployment/hubble-relay -n kube-system
kubectl rollout restart ds/cilium -n kube-system
验证确认
重新检查 Hubble 状态:
cilium hubble status
显示 Hubble is successfully connected,实时 L3/L4/L7 流拓扑图恢复呈现。


