allowVolumeExpansion
to true
in the Storageclass. Below is an example:allowVolumeExpansion: trueapiVersion: storage.k8s.io/v1kind: StorageClassmetadata:name: cbs-csi-expandparameters:diskType: CLOUD_PREMIUMprovisioner: com.tencent.cloud.csi.cbsreclaimPolicy: DeletevolumeBindingMode: Immediate
Expansion Method | Description |
Online expansion with restarting the Pod | The CBS document system to be expanded is not mounted, and expansion errors and issues in method 2 can be avoided. We recommend that you use this method for expansion. |
Online expansion without restarting the Pod | The CBS document system to be expanded is mounted on the node. If there is an I/O process, a document system expansion error may occur. |
$ 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
Pending
status because the label of the PV corresponding to the Pod indicates that it is in an invalid zone. Below is an example:$ 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
Running
, and the size of both the corresponding PV and document system has expanded from 30G to 40G. Below is an example:$ 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
Apakah halaman ini membantu?