allowVolumeExpansion
为 true
。示例如下:allowVolumeExpansion: trueapiVersion: storage.k8s.io/v1kind: StorageClassmetadata:name: cbs-csi-expandparameters:diskType: CLOUD_PREMIUMprovisioner: com.tencent.cloud.csi.cbsreclaimPolicy: DeletevolumeBindingMode: Immediate
扩容方式 | 说明 |
重启 Pod 的情况下在线扩容 | 待扩容的云硬盘文件系统未被挂载,能够避免扩容出错以及方式2存在的问题。推荐使用该方式进行扩容。 |
不重启 Pod 的情况下在线扩容 | 在节点上挂载着待扩容的云硬盘文件系统,如果存在 I/O 进程,将可能出现文件系统扩容错误。 |
$ kubectl exec ivantestweb-0 df /usr/share/nginx/htmlFilesystem 1K-blocks Used Available Use% Mounted on/dev/vdd 30832548 44992 30771172 1% /usr/share/nginx/html$ kubectl get pv pvc-e193201e-6f6d-48cf-b96d-ccc09225cf9cNAME CAPACITY ACCESS MODES RECLAIM POLICY STATUS CLAIM STORAGECLASS REASON AGEpvc-e193201e-6f6d-48cf-b96d-ccc09225cf9c 30Gi RWO Delete Bound default/www1-ivantestweb-0 cbs-csi 20h
$ kubectl label pv pvc-e193201e-6f6d-48cf-b96d-ccc09225cf9c failure-domain.beta.kubernetes.io/zone=nozone
$ kubectl delete pod ivantestweb-0$ kubectl get pod ivantestweb-0NAME READY STATUS RESTARTS AGEivantestweb-0 0/1 Pending 0 25s$ kubectl describe pod ivantestweb-0Events:Type Reason Age From Message---- ------ ---- ---- -------Warning FailedScheduling 40s (x3 over 2m3s) default-scheduler 0/1 nodes are available: 1 node(s) had no available volume zone.
kubectl patch pvc www1-ivantestweb-0 -p '{"spec":{"resources":{"requests":{"storage":"40Gi"}}}}'
$ kubectl label pv pvc-e193201e-6f6d-48cf-b96d-ccc09225cf9c failure-domain.beta.kubernetes.io/zone-persistentvolume/pvc-e193201e-6f6d-48cf-b96d-ccc09225cf9c labeled
$ kubectl get pod ivantestweb-0NAME READY STATUS RESTARTS AGEivantestweb-0 1/1 Running 0 17m$ kubectl get pv pvc-e193201e-6f6d-48cf-b96d-ccc09225cf9cNAME CAPACITY ACCESS MODES RECLAIM POLICY STATUS CLAIM STORAGECLASS REASON AGEpvc-e193201e-6f6d-48cf-b96d-ccc09225cf9c 40Gi RWO Delete Bound default/www1-ivantestweb-0 cbs-csi 20h$ kubectl get pvc www1-ivantestweb-0NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGEwww1-ivantestweb-0 Bound pvc-e193201e-6f6d-48cf-b96d-ccc09225cf9c 40Gi RWO cbs-csi 20h$ kubectl exec ivantestweb-0 df /usr/share/nginx/htmlFilesystem 1K-blocks Used Available Use% Mounted on/dev/vdd 41153760 49032 41088344 1% /usr/share/nginx/html
$ kubectl exec ivantestweb-0 df /usr/share/nginx/htmlFilesystem 1K-blocks Used Available Use% Mounted on/dev/vdd 20511312 45036 20449892 1% /usr/share/nginx/html$ kubectl get pv pvc-e193201e-6f6d-48cf-b96d-ccc09225cf9cNAME CAPACITY ACCESS MODES RECLAIM POLICY STATUS CLAIM STORAGECLASS REASON AGEpvc-e193201e-6f6d-48cf-b96d-ccc09225cf9c 20Gi RWO Delete Bound default/www1-ivantestweb-0 cbs-csi 20h
$ kubectl patch pvc www1-ivantestweb-0 -p '{"spec":{"resources":{"requests":{"storage":"30Gi"}}}}'
$ kubectl exec ivantestweb-0 df /usr/share/nginx/htmlFilesystem 1K-blocks Used Available Use% Mounted on/dev/vdd 30832548 44992 30771172 1% /usr/share/nginx/html$ kubectl get pv pvc-e193201e-6f6d-48cf-b96d-ccc09225cf9cNAME CAPACITY ACCESS MODES RECLAIM POLICY STATUS CLAIM STORAGECLASS REASON AGEpvc-e193201e-6f6d-48cf-b96d-ccc09225cf9c 30Gi RWO Delete Bound default/www1-ivantestweb-0 cbs-csi 20h
本页内容是否解决了您的问题?