Skip to main content
Version: release-0.9

Expand volume

You can expand the storage volume size of each pod.

note

Volume expansion triggers pod restart, all pods restart in the order of learner -> follower -> leader and the leader pod may change after the operation.

Before you start

Check whether the cluster status is Running. Otherwise, the following operations may fail.

kubectl get cluster mycluster -n demo
>
NAME CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS AGE
mycluster apecloud-mysql ac-mysql-8.0.30 Delete Running 27m

Steps

  1. Apply an OpsRequest. Change the value of storage according to your need and run the command below to expand the volume of a cluster.

    kubectl apply -f - <<EOF
    apiVersion: apps.kubeblocks.io/v1alpha1
    kind: OpsRequest
    metadata:
    name: ops-volume-expansion
    namespace: demo
    spec:
    clusterName: mycluster
    type: VolumeExpansion
    volumeExpansion:
    - componentName: mysql
    volumeClaimTemplates:
    - name: data
    storage: "40Gi"
    EOF
  2. Validate the volume expansion operation.

    kubectl get ops -n demo
    >
    NAME TYPE CLUSTER STATUS PROGRESS AGE
    mycluster-volumeexpansion-8257f VolumeExpansion mycluster Succeed 3/3 4m40s

    If an error occurs, you can troubleshoot with kubectl describe ops -n demo command to view the events of this operation.

  3. After the cluster status is Running again, check whether the corresponding cluster resources change.

    kubectl describe cluster mycluster -n demo