All Products
Search
Document Center

Container Service for Kubernetes:Expand a cloud disk volume online

Last Updated:Mar 26, 2026

The Container Storage Interface (CSI) plug-in in ACK lets you expand a cloud disk volume by modifying a persistent volume claim (PVC) — without restarting or interrupting your running pods. This requires Kubernetes 1.16 or later.

Prerequisites

Before you begin, make sure that:

  • The StorageClass bound to the PVC has allowVolumeExpansion: true. ACK-provided StorageClasses have this set by default. For custom StorageClasses, you must set it manually. StorageClass properties cannot be changed after creation — create a new StorageClass if needed.

  • The pod using the disk is in the Running state.

  • The disk is not a basic disk. Basic disks do not support online expansion.

  • The cluster runs Kubernetes 1.16 or later. To upgrade, see Upgrade clusters.

  • The disk supports resizing. See ResizeDisk for supported disk types.

Important

Create a snapshot before resizing to back up your data. Delete the snapshot after expansion completes to avoid unnecessary charges. See Use disk snapshots.

ACK dedicated clusters only: Grant the ResizeDisk permission to the cluster's RAM role. ACK managed clusters already have this permission.

  1. Log on to the ACK console and click Clusters.

  2. Click the cluster name, then click Cluster Information in the left-side pane.

  3. On the Basic Information tab, find Master RAM Role in the Cluster Resources section and click the link.

  4. On the Roles page in the RAM console, add the ResizeDisk permission. See Modify the document and description of a custom policy.

resizedisk

Expand a disk volume using kubectl

The following example uses a disk volume created in Create a dynamically provisioned disk volume. Modifying the PVC triggers the CSI plug-in to resize the underlying disk and expand the filesystem online — the pod keeps running throughout.

  1. Connect to your cluster. See Obtain the kubeconfig file of a cluster and use kubectl to connect to the cluster or Use kubectl on Workbench or Cloud Shell to connect to ACK clusters.

  2. Verify that the pod is in the Running state.

    kubectl get pod -l app=nginx

    Expected output:

    NAME          READY   STATUS    RESTARTS   AGE
    disk-test-0   1/1     Running   0          23h
  3. Check the current disk usage and PVC.

    Important

    For a statically provisioned disk volume, make sure that storageClassName in the PVC is not blank and that a StorageClass with that name exists in the cluster. If no matching StorageClass exists, create one with the existing disk's attributes and set allowVolumeExpansion: true.

    kubectl exec disk-test-0 -- df -h /data

    Expected output:

    Filesystem      Size  Used Avail Use% Mounted on
    /dev/vdb         20G   24K   20G   1% /data
    kubectl get pvc

    Expected output (PVC disk-pvc is bound with 20 GiB capacity):

    NAME       STATUS   VOLUME                   CAPACITY   ACCESS MODES   STORAGECLASS                            VOLUMEATTRIBUTESCLASS   AGE
    disk-pvc   Bound    d-uf6axyb1er071h6o****   20Gi       RWO            alicloud-disk-wait-for-first-consumer   <unset>                 23h
  4. Confirm the StorageClass has allowVolumeExpansion: true.

    kubectl get sc alicloud-disk-wait-for-first-consumer -o yaml

    Expected output:

    allowVolumeExpansion: true
    apiVersion: storage.k8s.io/v1
    kind: StorageClass
    metadata:
      creationTimestamp: "2025-01-21T08:48:26Z"
      name: alicloud-disk-wait-for-first-consumer
      resourceVersion: "59936"
      uid: 5bdb798e-5888-40df-9f91-259ee8510f34
    parameters:
      type: cloud_auto,cloud_essd,cloud_ssd
    provisioner: diskplugin.csi.alibabacloud.com
    reclaimPolicy: Retain
    volumeBindingMode: WaitForFirstConsumer
  5. Patch the PVC to request 30 GiB.

    kubectl patch pvc disk-pvc -p '{"spec":{"resources":{"requests":{"storage":"30Gi"}}}}'
  6. Wait for a minute, then verify the new capacity.

    kubectl get pvc

    Expected output:

    NAME       STATUS   VOLUME                   CAPACITY   ACCESS MODES   STORAGECLASS                            VOLUMEATTRIBUTESCLASS   AGE
    disk-pvc   Bound    d-uf6axyb1er071h6o****   30Gi       RWO            alicloud-disk-wait-for-first-consumer   <unset>                 23h
    kubectl exec disk-test-0 -- df -h /data

    Expected output:

    Filesystem      Size  Used Avail Use% Mounted on
    /dev/vdb         30G   24K   30G   1% /data

Expand a disk volume using the ACK console

Note

The ACK console supports only dynamically provisioned disk volumes. For statically provisioned disk volumes, use kubectl.

  1. Log on to the ACK console and click Clusters.

  2. Click the cluster name to go to the cluster management page.

  3. Verify the pod state and find the PVC.

    1. In the left-side navigation pane, choose Workloads > StatefulSets.

    2. Click the application name. On the Pods tab, confirm the pod is in the Running state. 扩容-容器组

    3. Click the pod name. On the Volumes tab, note the PVC used by the pod. 扩容-pvc

  4. Confirm the StorageClass has expansion enabled.

    1. In the left-side navigation pane, choose Volumes > Storage Classes.

    2. Find the StorageClass used by the disk volume and click View in YAML.

    3. Confirm allowVolumeExpansion: true is present. 扩容的SC

  5. Expand the PVC.

    1. In the left-side navigation pane, choose Volumes > Persistent Volume Claims.

    2. Find the PVC and click Expand.

    3. Enter the new capacity, select I understand and agree to the preceding operations, and click OK. 在线扩容

    4. Wait for expansion to complete, then verify the PVC shows the new capacity.

What's next