# 挂载卷 "pvc-xxx" 失败：rpc 错误：code = DeadlineExceeded desc = 上下文截止时间已超过

- **ID:** `kubernetes/volume-attach-timeout-csi`
- **领域:** kubernetes
- **类别:** runtime_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

CSI 驱动程序在将持久卷挂载到节点时超时，通常是由于云提供商 API 限流或 CSI 控制器与存储后端之间的网络问题。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| Kubernetes 1.24 | active | — | — |
| Kubernetes 1.27 | active | — | — |
| AWS EBS CSI Driver 1.12 | active | — | — |
| GCE PD CSI Driver 1.8 | active | — | — |

## 解决方案

1. ```
   Check CSI driver logs for specific errors: `kubectl logs -n kube-system <csi-controller-pod> csi-provisioner` and look for throttling or backend errors.
   ```
2. ```
   Increase the CSI driver's attach timeout by setting environment variable `ATTACH_TIMEOUT=5m` in the CSI controller deployment, then restart the pods.
   ```
3. ```
   Verify cloud provider API quotas (e.g., AWS EC2 API call rate limits) and request a quota increase if needed: `aws ec2 describe-account-attributes`.
   ```

## 无效尝试

- **** — Restarting the CSI controller pod without checking cloud provider quotas or API rate limits will not resolve the underlying throttling issue. (70% 失败率)
- **** — Increasing CSI driver timeout without addressing storage backend latency only delays the failure. (50% 失败率)
- **** — Deleting and recreating the PVC/PV pair may be blocked by finalizers and does not fix the attach timeout root cause. (60% 失败率)
