阿里云 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

更新之后成功。

相关推荐
小章UPUP17 分钟前
Kubernetes (K8s) 与 Podman 的比较
容器·kubernetes·podman
农民工老王3 小时前
K8s 1.31 私有化部署实战:从 Calico 崩溃到 NFS 挂载失败的排坑全记录
云原生·kubernetes
广州中轴线3 小时前
OpenStack on Kubernetes 生产部署实战(十四)
kubernetes·智能路由器·openstack
m0_694845573 小时前
tinylisp 是什么?超轻量 Lisp 解释器编译与运行教程
服务器·开发语言·云计算·github·lisp
ESBK20253 小时前
第四届移动互联网、云计算与信息安全国际会议(MICCIS 2026)二轮征稿启动,诚邀全球学者共赴学术盛宴
大数据·网络·物联网·网络安全·云计算·密码学·信息与通信
是阿楷啊5 小时前
Java大厂面试场景:音视频场景中的Spring Boot与微服务实战
spring boot·redis·spring cloud·微服务·grafana·prometheus·java面试
_运维那些事儿16 小时前
VM环境的CI/CD
linux·运维·网络·阿里云·ci/cd·docker·云计算
人间打气筒(Ada)20 小时前
k8s:CNI网络插件flannel与calico
linux·云原生·容器·kubernetes·云计算·k8s
江畔何人初21 小时前
pod的内部结构
linux·运维·云原生·容器·kubernetes
小白考证进阶中1 天前
阿里云ACA热门科目有哪些?考什么内容?
阿里云·阿里云认证·云计算运维·阿里云aca证书·阿里云aca认证·阿里云aca·aca证书