挂载卷 "pvc-xxx" 失败:rpc 错误:code = DeadlineExceeded desc = 上下文截止时间已超过
AttachVolume.Attach failed for volume "pvc-xxx" : rpc error: code = DeadlineExceeded desc = context deadline exceeded
ID: kubernetes/volume-attach-timeout-csi
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| Kubernetes 1.24 | active | — | — | — |
| Kubernetes 1.27 | active | — | — | — |
| AWS EBS CSI Driver 1.12 | active | — | — | — |
| GCE PD CSI Driver 1.8 | active | — | — | — |
根因分析
CSI 驱动程序在将持久卷挂载到节点时超时,通常是由于云提供商 API 限流或 CSI 控制器与存储后端之间的网络问题。
English
CSI driver timed out while attaching a persistent volume to a node, often due to cloud provider API throttling or network issues between the CSI controller and storage backend.
官方文档
https://kubernetes.io/docs/concepts/storage/volumes/#csi解决方案
-
Check CSI driver logs for specific errors: `kubectl logs -n kube-system <csi-controller-pod> csi-provisioner` and look for throttling or backend errors.
-
Increase the CSI driver's attach timeout by setting environment variable `ATTACH_TIMEOUT=5m` in the CSI controller deployment, then restart the pods.
-
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`.
无效尝试
常见但无效的做法:
-
70% 失败
Restarting the CSI controller pod without checking cloud provider quotas or API rate limits will not resolve the underlying throttling issue.
-
50% 失败
Increasing CSI driver timeout without addressing storage backend latency only delays the failure.
-
60% 失败
Deleting and recreating the PVC/PV pair may be blocked by finalizers and does not fix the attach timeout root cause.