# 错误：无法升级连接：拨号 tcp：输入/输出超时

- **ID:** `kubernetes/kubectl-exec-tcp-timeout`
- **领域:** kubernetes
- **类别:** network_error
- **错误码:** `K8S-EXEC-005`
- **验证级别:** ai_generated
- **修复率:** 82%

## 根因

kube-apiserver 无法与节点上的 kubelet 建立用于 exec/logs/attach 操作的连接，通常是由于网络策略、防火墙规则或节点不可用。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| kubernetes 1.22 | active | — | — |
| kubernetes 1.23 | active | — | — |
| kubernetes 1.24 | active | — | — |
| kubernetes 1.27 | active | — | — |

## 解决方案

1. ```
   验证从控制平面节点到目标节点在端口 10250（kubelet 端口）上的网络连通性：`nc -zv <node-ip> 10250`。如果被阻止，更新防火墙规则或网络策略以允许流量。
   ```
2. ```
   检查节点是否处于 'NotReady' 状态。如果是，在节点上调查 kubelet 日志（`journalctl -u kubelet`）并重启 kubelet 服务。
   ```

## 无效尝试

- **Restart the kube-apiserver pod.** — The issue is on the node side (kubelet or network), not the API server; restarting the API server won't help. (95% 失败率)
- **Increase the kubelet's timeout settings.** — The timeout is due to connectivity, not latency; increasing timeouts only delays the failure. (70% 失败率)
