K8S-EXEC-005
kubernetes
network_error
ai_generated
true
错误:无法升级连接:拨号 tcp:输入/输出超时
error: unable to upgrade connection: dial tcp: i/o timeout
ID: kubernetes/kubectl-exec-tcp-timeout
82%修复率
86%置信度
1证据数
2023-11-02首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| kubernetes 1.22 | active | — | — | — |
| kubernetes 1.23 | active | — | — | — |
| kubernetes 1.24 | active | — | — | — |
| kubernetes 1.27 | active | — | — | — |
根因分析
kube-apiserver 无法与节点上的 kubelet 建立用于 exec/logs/attach 操作的连接,通常是由于网络策略、防火墙规则或节点不可用。
English
The kube-apiserver cannot establish a connection to the kubelet on the node for exec/logs/attach operations, usually due to network policies, firewall rules, or node unavailability.
官方文档
https://kubernetes.io/docs/reference/kubectl/kubectl-exec/解决方案
-
验证从控制平面节点到目标节点在端口 10250(kubelet 端口)上的网络连通性:`nc -zv <node-ip> 10250`。如果被阻止,更新防火墙规则或网络策略以允许流量。
-
检查节点是否处于 'NotReady' 状态。如果是,在节点上调查 kubelet 日志(`journalctl -u kubelet`)并重启 kubelet 服务。
无效尝试
常见但无效的做法:
-
Restart the kube-apiserver pod.
95% 失败
The issue is on the node side (kubelet or network), not the API server; restarting the API server won't help.
-
Increase the kubelet's timeout settings.
70% 失败
The timeout is due to connectivity, not latency; increasing timeouts only delays the failure.