Help Center/ Cloud Container Engine/ User Guide/ Storage/ EVS/ Configuring Automatic Capacity Expansion for EVS Disks
Updated on 2026-09-29 GMT+08:00

Configuring Automatic Capacity Expansion for EVS Disks

CCE supports automatic capacity expansion for cloud disks through Custom Resource Definitions (CRDs). When a volume's available capacity falls below a specified threshold, the system automatically expands the volume to ensure service continuity. This section describes how to configure an automatic capacity expansion policy using the Everest StorageAutoScalerPolicy and verify the expansion behavior.

Prerequisites

A cluster with CCE Container Storage (Everest) v2.5.92 or later installed is available.

Constraints

  • The PVC bound to the cloud disk's PV must be provisioned by a StorageClass that has allowVolumeExpansion: true enabled.

    CCE's default StorageClass has this parameter pre-configured. For custom StorageClasses, you must set this parameter during creation, as StorageClass properties are immutable after creation.

  • Workload pods using the EVS disk must be in the Running state.
  • The maximum detection interval is approximately 2 minutes, with expansion taking about 1 minute. Ensure the disk does not exhaust capacity within this 3-minute window.
  • Do not associate multiple policies with the same PVC. If multiple policies match, only the most recently created policy applies.
  • Deleting the Everest add-on does not automatically delete associated expansion policies or CRDs.
  • If security groups or ACL rules are configured, ensure nodes can receive traffic on port 3125 from containers.

Procedure

  1. Create a StatefulSet and PVC.

    1. Create statefulset.yaml using volumeClaimTemplates to automatically provision a dedicated PVC for each pod, and apply labels to facilitate subsequent policy matching.
      apiVersion: apps/v1
      kind: StatefulSet
      metadata:
        name: nginx
        namespace: default
      spec:
        replicas: 1
        selector:
          matchLabels:
            app: nginx
        serviceName: nginx
        template:
          metadata:
            labels:
              app: nginx
          spec:
            containers:
              - name: nginx
                image: nginx:alpine  # Replace it with your application image.
                volumeMounts:
                  - name: data
                    mountPath: /data
        volumeClaimTemplates:              # Automatically creates a PVC per pod.
          - metadata:
              name: data
              labels:
                app: nginx                 # The PVC inherits this label for policy matching.
            spec:
              accessModes: ["ReadWriteOnce"]
              storageClassName: csi-disk
              resources:
                requests:
                  storage: 10Gi
    2. Deploy the application.
      kubectl apply -f statefulset.yaml
    3. Verify PVC creation and binding.
      kubectl get pvc -l app=nginx

      Expected output:

      NAME           STATUS   VOLUME                                     CAPACITY   ACCESS MODES   STORAGECLASS   AGE
      data-nginx-0   Bound    pvc-d8073e47-939f-4ebb-b1c0-ff6cf1******   10Gi       RWO            csi-disk       18s
    4. Check whether the pod is in the Running state.
      kubectl get pod nginx-0

      Expected output:

      NAME       READY   STATUS    RESTARTS   AGE
      nginx-0    1/1     Running   0          17s

  2. Configure the automatic expansion policy.

    1. Create a file named pvc-auto-expansion-policy.yaml defining a StorageAutoScalerPolicy in the kube-system namespace, specifying the expansion threshold and step size.
      apiVersion: storage.everest.io/v1
      kind: StorageAutoScalerPolicy
      metadata:
        name: pvc-auto-expansion
        namespace: kube-system
      spec:
        namespaces:
          - default
        pvcSelector:
          matchLabels:
            app: nginx
        maxCapacity: 15Gi
        rule:
          availableCapacityThreshold: "20%"
          expansionStep: "50%"

      The following table lists involved parameters.

      Parameter

      Type

      Mandatory

      Description

      spec.namespaces

      String array

      Yes

      Namespaces where the policy applies. Use specific names (for example, ["default", "production"]) or wildcard ["*"] for all namespaces. The wildcard cannot be combined with specific names.

      spec.pvcSelector

      LabelSelector

      Yes

      Label selector (matchLabels or matchExpressions) to identify target PVCs. Only PVCs matching these labels will be managed by the policy. The selector must not be empty. An empty selector matches no PVCs.

      spec.maxCapacity

      string

      Yes

      Maximum capacity for single PVC expansion. Only absolute values are supported, for example, 500Gi or 1Ti.

      Expansion results exceeding this value are truncated to maxCapacity.

      spec.rule.availableCapacityThreshold

      string

      Yes

      Threshold that triggers expansion when available capacity falls below this value. Supported formats:

      • Percentage: For example, 20% triggers when available capacity is less than 20% of total capacity. This value is dynamically calculated based on current PVC capacity.
      • Absolute: For example, 5Gi triggers when available capacity is less than 5 GiB. This is a fixed threshold that does not change with PVC capacity.

      spec.rule.expansionStep

      string

      Yes

      Capacity increment added per expansion. After expansion is triggered, PVC capacity increases by this step. Supported formats:

      • Percentage: For example, 50% adds 50% of current capacity (10 GiB to 15 GiB). This value is dynamically calculated based on current PVC capacity.
      • Absolute: For example, 5Gi adds 5 GiB per expansion. This is a fixed increment that does not change with PVC capacity.
    2. Create the automatic capacity expansion policy.
      kubectl apply -f pvc-auto-expansion-policy.yaml

  3. Trigger expansion by consuming disk space.

    1. Write data to the pod's disk until available capacity falls below the 20% threshold.
      kubectl exec nginx-0 -- sh -c 'dd if=/dev/zero of=/data/fill bs=1M count=8300'
    2. Verify that disk usage has exceeded the threshold (available capacity has dropped below 20%).
      kubectl exec nginx-0 -- sh -c 'df -h /data'

      Expected output:

      Filesystem      Size  Used Avail Use% Mounted on
      /dev/sda        9.8G  8.2G  1.7G  84% /data

      The available capacity shows approximately 17% (1.7 GiB/9.8 GiB), which is below the 20% threshold.

    3. Wait for the controller to synchronize data. The controller checks disk usage every 60 seconds; the next synchronization cycle will automatically trigger capacity expansion.

  4. Verify automatic expansion.

    1. Check the PVC capacity change.
      kubectl get pvc data-nginx-0

      Expected output:

      NAME           STATUS   VOLUME                                     CAPACITY   ACCESS MODES   STORAGECLASS   AGE
      data-nginx-0   Bound    pvc-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx   15Gi       RWO            csi-disk       3m29s

      The PVC capacity has been expanded from 10 GiB to 15 GiB. The expansion step configured in the policy is 50%, so 50% of the current capacity (10 GiB × 50% = 5 GiB) is added during each expansion. Therefore, the final capacity is 10 GiB + 5 GiB = 15 GiB.

    2. View expansion events.
      kubectl get events

      Expected output:

      LAST SEEN   TYPE     REASON                       OBJECT                                MESSAGE
      100s        Normal   PVCExpanded                  persistentvolumeclaim/data-nginx-0   PVC default/data-nginx-0 auto expanded from 10Gi to 15Gi (remaining: 16.7%, policy: pvc-auto-expansion)
      100s        Normal   Resizing                     persistentvolumeclaim/data-nginx-0   External resizer is resizing volume pvc-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
      100s        Normal   ExternalExpanding            persistentvolumeclaim/data-nginx-0   waiting for an external controller to expand this PVC
      96s         Normal   FileSystemResizeRequired     persistentvolumeclaim/data-nginx-0   Require file system resize of volume on node
      25s         Normal   FileSystemResizeSuccessful   persistentvolumeclaim/data-nginx-0   MountVolume.NodeExpandVolume succeeded for volume "pvc-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" 192.168.x.x
    3. Verify file system expansion inside the pod.
      kubectl exec nginx-0 -- sh -c 'df -h /data'

      Expected output:

      Filesystem      Size  Used Avail Use% Mounted on
      /dev/sda         15G  8.2G  6.6G  56% /data

      The file system has been expanded from 10 GiB to 15 GiB, and available capacity has increased from 1.7 GiB to 6.6 GiB. Capacity expansion is complete.

FAQs

Helpful Links