Skip to main content

Expanding CBS Type PVCs

Overview

In TKE, PVCs are typically used to declare storage capacity and type, automatically bind PVs, and mount them to Pods. Cloud Block Storage (CBS) is commonly used. When CBS disk capacity becomes insufficient, how do you expand it? This article details two scenarios.

Expansion Methods

If the TKE cluster version is 1.20 or above, the CSI plugin is definitely used. If below 1.20, but the CBS CSI extension component is installed, and the PVC references a CBS CSI type StorageClass with online expansion capability enabled, then you can directly modify the PVC capacity to automatically expand the PV capacity.

How to Enable Online Expansion?

Since CBS CSI plugin expansion of PVCs is too simple (just one step of modifying PVC capacity), let's first explain how to ensure PVCs can be expanded online.

  1. First, the StorageClass needs to enable the online expansion option:

If creating StorageClass via console, ensure 【Enable Online Expansion】 is checked (enabled by default):

  1. Then when creating PVC, remember to select a CBS CSI type StorageClass that has online expansion enabled:

  1. Finally, when you need to expand the PVC, directly modify the PVC capacity:
Note

After modification, the corresponding CBS disk capacity will automatically expand to the specified size (must be multiples of 10Gi). You can verify in the Cloud Disk console.

FAQ

Do I Need to Restart Pods?

You can expand without restarting pods, but in this case, the filesystem of the expanded cloud disk is mounted on the node. If there's frequent I/O, filesystem expansion errors may occur. To ensure filesystem stability, it's recommended to expand when the cloud disk filesystem is not mounted. You can scale Pod replicas to 0 or modify the PV to mark it with an invalid zone (kubectl label pv pvc-xxx failure-domain.beta.kubernetes.io/zone=nozone) to make Pods Pending after rebuild, then modify PVC capacity for online expansion, and finally restore Pods to Running to mount the expanded disk.

How to Create a Safety Net for Expansion to Avoid Data Issues?

You can use snapshots to backup data before expansion to avoid data loss in case of expansion failure.