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

     1  ---
     2  title: Expand volume
     3  description: How to expand the volume of a MongoDB cluster
     4  keywords: [mongodb, 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 mongodb-cluster
    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=mongodb --volume-claim-templates=data mongodb-cluster
    27  >
    28  OpsRequest mongodb-cluster-volumeexpansion-gcfzp created successfully, you can view the progress:
    29          kbcli cluster describe-ops mongodb-cluster-volumeexpansion-gcfzp -n default
    30  ```
    31  
    32  - `--component-names` describes the component name for volume expansion.
    33  - `--volume-claim-templates` describes the VolumeClaimTemplate names in components.
    34  - `--storage` describes the volume storage size.
    35  
    36  ## Option 2. Change the YAML file of the cluster
    37  
    38  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.
    39  
    40  ```yaml
    41  apiVersion: apps.kubeblocks.io/v1alpha1
    42  kind: Cluster
    43  metadata:
    44    name: mongodb-cluster
    45    namespace: default
    46  spec:
    47    clusterDefinitionRef: mongodb
    48    clusterVersionRef: mongodb-5.0
    49    componentSpecs:
    50    - name: mongodb 
    51      componentDefRef: mongodb
    52      replicas: 1
    53      volumeClaimTemplates:
    54      - name: data
    55        spec:
    56          accessModes:
    57            - ReadWriteOnce
    58          resources:
    59            requests:
    60              storage: 1Gi # Change the volume storage size.
    61    terminationPolicy: Halt
    62  ```