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

更新之后成功。

相关推荐
啊啊啊啊84317 分钟前
Kubernetes 1.20集群部署
云原生·容器·kubernetes
morning_sir_jking2 小时前
深入解析 kube-proxy:Kubernetes 服务发现的网络基石
网络·kubernetes·服务发现
忧郁的橙子.3 小时前
十二、kubernetes 1.29 之 存储 Volume、pv/pvc
云原生·容器·kubernetes
霍小毛4 小时前
Kubernetes云平台管理实战:滚动升级与秒级回滚
java·容器·kubernetes
wanhengidc5 小时前
云手机长期使用会消耗很多流量吗
网络·游戏·智能手机·架构·云计算
电话交换机IPPBX-3CX5 小时前
Grafana图表与电话交换机的结合
数据库·mysql·grafana·ip pbx·电话交换机
神秘人X7075 小时前
Docker监控:cAdvisor+Prometheus+Grafana实战指南
docker·grafana·prometheus
小诸葛的博客5 小时前
k8s lease使用案例
云原生·容器·kubernetes
红尘客栈26 小时前
Kubernetes 集群调度
java·linux·网络·容器·kubernetes
m0_464608266 小时前
Kubernetes 集群调度与PV和PVC
云原生·容器·kubernetes