Skip to main content
Version: release-0.9

Expand volume

You can expand the storage volume size of each pod.

Before you start

Run the command below to check whether the cluster STATUS is Running. Otherwise, the following operations may fail.

kubectl -n demo get cluster mycluster
>
NAME CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS AGE
mycluster kafka kafka-3.3.2 Delete Running 19m

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-volumeexpansion
    namespace: demo
    spec:
    clusterName: mycluster
    type: VolumeExpansion
    volumeExpansion:
    - componentName: broker
    volumeClaimTemplates:
    - name: data
    storage: 40Gi
    EOF
  2. Validate the volume expansion operation.

    kubectl get ops -n demo
    >
    NAMESPACE NAME TYPE CLUSTER STATUS PROGRESS AGE
    demo ops-volume-expansion VolumeExpansion mycluster Succeed 3/3 6m
  3. Check whether the corresponding cluster resources change.

    kubectl describe cluster mycluster -n demo
    >
    ...
    Volume Claim Templates:
    Name: data
    Spec:
    Access Modes:
    ReadWriteOnce
    Resources:
    Requests:
    Storage: 40Gi