KubeBlocks
BlogsKubeBlocks Cloud
⌘K
​

Introduction

ApeCloud MySQL introduction
KubeBlocks for ApeCloud MySQL

Cluster Management

Create and connect
Scale
Expand volume
Restart
Stop/Start
Switchover
Delete protection

Configuration

Configuration

High Availability

Failure simulation and automatic recovery

Proxy

Introduction
ApeCloud MySQL Proxy Cluster
  1. Before you start
  2. Steps

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
kbcli cluster list mycluster -n demo > NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME mycluster demo apecloud-mysql ac-mysql-8.0.30 Delete Running Sep 19,2024 16:01 UTC+0800

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
  1. Change the value of spec.componentSpecs.volumeClaimTemplates.spec.resources in the cluster YAML file.

    spec.componentSpecs.volumeClaimTemplates.spec.resources is the storage resource information of the pod and changing this value triggers the volume expansion of a cluster.

    kubectl edit cluster mycluster -n demo

    Edit the value of spec.componentSpecs.volumeClaimTemplates.spec.resources.

    apiVersion: apps.kubeblocks.io/v1alpha1 kind: Cluster metadata: name: mycluster namespace: demo spec: clusterDefinitionRef: apecloud-mysql clusterVersionRef: ac-mysql-8.0.30 componentSpecs: - name: mysql componentDefRef: mysql replicas: 3 volumeClaimTemplates: - name: data spec: accessModes: - ReadWriteOnce resources: requests: storage: 40Gi # Change the volume storage size terminationPolicy: Delete
  2. Check whether the corresponding cluster is running and whether resources change.

    kubectl get cluster mycluster -n demo kubectl describe cluster mycluster -n demo
  1. Change configuration.

    Configure the values of --components, --volume-claim-templates, and --storage, and run the command below to expand the volume.

    kbcli cluster volume-expand mycluster --components="mysql" --volume-claim-templates="data" --storage="40Gi" -n demo
    • --components describes the component name for volume expansion.
    • --volume-claim-templates describes the VolumeClaimTemplate names in components.
    • --storage describes the volume storage size.
  2. Validate the volume expansion operation.

    • View the OpsRequest progress.

      KubeBlocks outputs a command automatically for you to view the details of the OpsRequest progress. The output includes the status of this OpsRequest and PVC. When the status is Succeed, this OpsRequest is completed.

      kbcli cluster describe-ops mycluster-volumeexpansion-8257f -n demo
    • View the cluster status.

      kbcli cluster list mycluster -n demo > NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME mycluster demo apecloud-mysql ac-mysql-8.0.30 Delete Updating Sep 19,2024 16:01 UTC+0800
      • STATUS=Updating: it means the volume expansion is in progress.
      • STATUS=Running: it means the volume expansion operation has been applied.
  3. After the OpsRequest status is Succeed or the cluster status is Running again, check whether the corresponding resources change.

    kbcli cluster describe mycluster -n demo

© 2025 ApeCloud PTE. Ltd.