In Kubernetes 1.16, the feature of expanding a disk volume without service interruptions is in public preview. Container Service for Kubernetes (ACK) allows you to use the Container Storage Interface (CSI) plug-in to expand a disk volume without service interruptions for clusters of Kubernetes 1.16 and later. This topic describes how to expand a disk volume without service interruptions.
Background information
The expansion includes the expansion of the disk size and the expansion of the file system. Both expansions can be performed without the need to stop the application to which the disk volume is mounted (the disk and file system are still mounted during the expansion). However, to ensure the stability of the file system and application, we recommend that you stop the application, unmount the disk volume from the directory, and then expand the disk volume.
Terms
- Expansion without service interruptions
Expand the mounted disk and file system without stopping the application pods.
- Expansion with service interruptions
Expand the mounted disk volume and file system after stopping the application pods, and restart the pods after the expansion is completed.
Kubernetes 1.16 and later allow you to expand a volume without stopping the pod to which the volume is mounted.
Usage notes
- Limits
You can expand only disks that are smaller than 2,000 GiB without service interruptions.
- Data backup
To avoid data loss caused by errors during the expansion, we recommend that you first create a snapshot for the disk to back up the disk data.
- Scenarios
- You can expand only dynamically provisioned persistent volumes (PVs) without service interruptions, which are mounted by using persistent volume claims (PVCs) that contain the StorageClassName parameter.
- You cannot expand disk volumes of the inline type. This type of disk volume is not created by using PVs and PVCs.
- You cannot expand volumes that are associated with basic disks without service interruptions.
- AllowVolumeExpansion: True must be specified for the StorageClass. The AllowVolumeExpansion parameter is automatically set to True for StorageClasses that are created by ACK. For StorageClasses that are manually created, you must manually set the AllowVolumeExpansion parameter to True.
- Plug-in version
Make sure that the FlexVolume or CSI plug-in is upgraded to the latest version.
Grant the ResizeDisk permission to the Resource Access Management (RAM) role of the cluster
Before you expand a disk volume without service interruptions, you must grant the ResizeDisk permission to the RAM role of the cluster. Perform the following steps based on the cluster type and the volume plug-in that is used:
Dedicated Kubernetes clusters that use CSI
- Log on to the ACK console.
- In the left-side navigation pane, click Clusters.
- On the Clusters page, find the cluster that you want to manage and click Details in the Actions column.
- In the left-side navigation pane, click Cluster Information.
- Click the Cluster Resources tab and click the hyperlink next to Master RAM Role.
- In the RAM console, grant the ResizeDisk permission to the RAM role. For more information, see Modify a custom policy.
Managed or dedicated Kubernetes clusters that use FlexVolume
Perform the preceding Step 1 to Step 4 and click the hyperlink next to Master RAM Role.