github.com/1aal/kubeblocks@v0.0.0-20231107070852-e1c03e598921/docs/user_docs/kubeblocks-for-kafka/cluster-management/expand-volume.md (about)

     1  ---
     2  title: Expand volume
     3  description: How to expand the volume of a kafka cluster
     4  keywords: [kafka, expand volume, volume expansion]
     5  sidebar_position: 3
     6  sidebar_label: Expand volume
     7  ---
     8  
     9  # Expand volume
    10  
    11  You can expand the storage volume size of each pod.
    12  
    13  ## Before you start
    14  
    15  Run the command below to check whether the cluster STATUS is `Running`. Otherwise, the following operations may fail.
    16  
    17  ```bash
    18  kbcli cluster list kafka  
    19  ```
    20  
    21  ## Option 1. Use kbcli
    22  
    23  Use `kbcli cluster volume-expand` command, configure the resources required and enter the cluster name again to expand the volume.
    24  
    25  ```bash
    26  kbcli cluster volume-expand --storage=30G --component-names=kafka --volume-claim-templates=data kafka
    27  ```
    28  
    29  - `--component-names` describes the component name for volume expansion.
    30  - `--volume-claim-templates` describes the VolumeClaimTemplate names in components.
    31  - `--storage` describes the volume storage size.
    32  
    33  ## Option 2. Change the YAML file of the cluster
    34  
    35  Change the value of `spec.components.volumeClaimTemplates.spec.resources` in the cluster YAML file. `spec.components.volumeClaimTemplates.spec.resources` is the storage resource information of the pod and changing this value triggers the volume expansion of a cluster.
    36  
    37  ```yaml
    38  apiVersion: apps.kubeblocks.io/v1alpha1
    39  kind: Cluster
    40  metadata:
    41    name: kafka
    42    namespace: default
    43  spec:
    44    clusterDefinitionRef: kafka
    45    clusterVersionRef: kafka-3.3.2
    46    componentSpecs:
    47    - name: kafka 
    48      componentDefRef: kafka
    49      replicas: 1
    50      volumeClaimTemplates:
    51      - name: data
    52        spec:
    53          accessModes:
    54            - ReadWriteOnce
    55          resources:
    56            requests:
    57              storage: 1Gi # Change the volume storage size.
    58    terminationPolicy: Halt
    59  ```