tencentyun / qcloud-documents

腾讯云官方文档
2.57k stars 3.57k forks source link

failed to provision volume with StorageClass "cbs" #10109

Closed huanghantao closed 2 years ago

huanghantao commented 2 years ago

按照文档操作,最后会报错:

failed to provision volume with StorageClass "cbs": rpc error: code = InvalidArgument desc = disk size is invalid. Must in [10, 32000]

以下是我的配置信息:

apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  annotations:
    storageclass.beta.kubernetes.io/is-default-class: "true"
  creationTimestamp: "2021-12-15T09:15:00Z"
  managedFields:
  - apiVersion: storage.k8s.io/v1
    fieldsType: FieldsV1
    fieldsV1:
      f:metadata:
        f:annotations:
          .: {}
          f:storageclass.beta.kubernetes.io/is-default-class: {}
      f:parameters:
        .: {}
        f:type: {}
      f:provisioner: {}
      f:reclaimPolicy: {}
      f:volumeBindingMode: {}
    manager: tke-operator
    operation: Update
    time: "2021-12-15T09:15:00Z"
  name: cbs
  resourceVersion: "12416293"
  selfLink: /apis/storage.k8s.io/v1/storageclasses/cbs
  uid: 60f739b7-ffd3-4d2e-a3e0-9ca16c0a9de9
parameters:
  type: cbs
provisioner: com.tencent.cloud.csi.cbs
reclaimPolicy: Delete
volumeBindingMode: Immediate
apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: web
spec:
  selector:
    matchLabels:
      app: nginx
  serviceName: "nginx"
  replicas: 3
  template:
    metadata:
      labels:
        app: nginx
    spec:
      terminationGracePeriodSeconds: 10
      containers:
      - name: nginx
        image: nginx
        ports:
        - containerPort: 80
          name: web
        volumeMounts:
        - name: www
          mountPath: /usr/share/nginx/html
  volumeClaimTemplates:  # 自动创建pvc,进而自动创建pv
  - metadata:
      name: www
    spec:
      accessModes: [ "ReadWriteOnce" ]
      storageClassName: cloud-premium
      resources:
        requests:
          storage: 10Gi
huanghantao commented 2 years ago

我的问题,volumeClaimTemplates.spec.resources.requests.storage最开始填的10Mi,后面报错后才修改为10Gi的。但是pvc是之前的,忘记删除了,以为10Gi 也报错了。