阿里云 K8s PVC 绑定 StorageClass 申领 PV 失败

错误场景: 因为阿里云没有默认的 StorageClass 我也懒得更新,所以就创建了一个类型是云盘的 StorageClass。 但是在创建 PVC 之后发现一直是 Pending 状态就查询了一下日志,然后看到很多下面这种错误

shell 复制代码
liudui@MacBookM1Pro ~ % kubectl describe pvc grafana-pvc
Error from server (NotFound): persistentvolumeclaims "grafana-pvc" not found
liudui@MacBookM1Pro ~ % kubectl describe pvc grafana-pvc  -n grafana-view
Name:          grafana-pvc
Namespace:     grafana-view
StorageClass:  grafana
Status:        Pending
Volume:
Labels:        <none>
Annotations:   volume.beta.kubernetes.io/storage-provisioner: diskplugin.csi.alibabacloud.com
Finalizers:    [kubernetes.io/pvc-protection]
Capacity:
Access Modes:
VolumeMode:    Filesystem
Used By:       grafana-566494879c-6drdf
Events:
  Type     Reason              Age   From                                                                                                  Message
  ----     ------              ----  ----                                                                                                  -------
  Warning  ProvisioningFailed  35s   diskplugin.csi.alibabacloud.com_csi-provisioner-5bfd5f4bb-l2m2j_fda93bfc-107f-4a5f-8596-ca3d15846878  failed to provision volume with StorageClass "grafana": rpc error: code = Internal desc = SDK.ServerError
ErrorCode: InvalidParameter
Recommend: https://api.aliyun.com/troubleshoot?q=InvalidParameter&product=Ecs
RequestId: 50A269B4-2ACA-572D-B1A5-84D91ACDE77F
Message: The specified parameter "Size" is not valid.
  Warning  ProvisioningFailed  35s  diskplugin.csi.alibabacloud.com_csi-provisioner-5bfd5f4bb-l2m2j_fda93bfc-107f-4a5f-8596-ca3d15846878  failed to provision volume with StorageClass "grafana": rpc error: code = Internal desc = SDK.ServerError
ErrorCode: InvalidParameter
Recommend: https://api.aliyun.com/troubleshoot?q=InvalidParameter&product=Ecs
RequestId: B6BD668D-C7EF-5BED-8E58-301A464B5D05
Message: The specified parameter "Size" is not valid.
  Warning  ProvisioningFailed  33s  diskplugin.csi.alibabacloud.com_csi-provisioner-5bfd5f4bb-l2m2j_fda93bfc-107f-4a5f-8596-ca3d15846878  failed to provision volume with StorageClass "grafana": rpc error: code = Internal desc = SDK.ServerError

使用的配置

yaml 复制代码
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: grafana-pvc
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 1Gi
  storageClassName: grafana

原因: 根据阿里云 FAQ 文档 发现在 PVC 中指定的云盘大小不符合规范,不同类型云盘有最小容量的限制,例如,高效云盘和 SSD 云盘要求最小 20GiB。

然后我的 PVC 申领的是 1GB 所以就导致了创建 PV 失败。

修复办法二选一

  • PVC storage 设置为最小 20 GiB
  • 更换其他 StorageClass 类型
shell 复制代码
liudui@MacBookM1Pro ~ % kubectl get pv -n grafana-view | grep grafana-pvc
d-bp1bgvzk7l5lkz3q1pr8                     30Gi       RWO            Delete           Bound    grafana-view/grafana-pvc                         grafana                 16m
liudui@MacBookM1Pro ~ % kubectl get pvc -n grafana-view
NAME          STATUS   VOLUME                   CAPACITY   ACCESS MODES   STORAGECLASS   AGE
grafana-pvc   Bound    d-bp1bgvzk7l5lkz3q1pr8   30Gi       RWO            grafana        16m

更新之后成功。

相关推荐
wzq11_66612 小时前
Kubernetes集群——基础篇(基础知识与搭建步骤一遍过!!!)
java·容器·kubernetes
余槐i14 小时前
将AI Agent嵌入现有Java系统时,Spring Boot 3.2的异步冲突与内存泄漏排查
人工智能·spring boot·性能优化·kubernetes·ai agent
河北小博博16 小时前
阿里云 ChatOps Agent 让非标准化环境可修复:内核漏洞换盘后的容器恢复
阿里云·云计算
旋生万物16 小时前
用螺旋数重写 Transformer Attention:让大模型自带“相位记忆“的 PyTorch 实现
docker·云原生·kubernetes·螺旋生成论·螺旋相位
编码如写诗17 小时前
【k8s】全新Ubuntu 26.04 使用kt 超简单安装 k8s 最新1.37.1+KubeSphere4.1.3
ubuntu·容器·kubernetes
小匠石钧知17 小时前
05_在k8s集群中安装NFS实现ReadWriteMany存储
java·容器·kubernetes·nfs·readwritemany·rwx
边境悍匪18 小时前
蜗牛学苑 Java 智能体学习 Day49|贯穿项目 5 订单下单业务 思维导图复盘
java·开发语言·spring boot·学习·阿里云
会议咨询19 小时前
2026年数据科学、云计算与智能技术国际会议(DCIT 2026)
云计算·数据科学·智能技术
万博智云OneProCloud1 天前
GPU 资源池化最佳实践:规划、调度、监控与运营的五步方法
kubernetes·算力调度·ai基础设施·gpu池化·agione·powerone
ha_lydms1 天前
MaxCompute中窗口函数
大数据·hadoop·阿里云·云计算·dataworks·maxcompute·odps