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 starrocks starrocks-3.1.1 Delete Running 4m29s
kbcli cluster list mycluster -n demo
>
NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
mycluster demo starrocks starrocks-3.1.1 Delete Running Jul 17,2024 19:06 UTC+0800
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: mycluster-volume-expansion
namespace: demo
spec:
clusterName: mycluster
type: VolumeExpansion
volumeExpansion:
- componentName: be
volumeClaimTemplates:
- name: be-storage
storage: "40Gi"
EOF
Validate the volume expansion operation.
kubectl get ops -n demo
>
NAMESPACE NAME TYPE CLUSTER STATUS PROGRESS AGE
demo mycluster-volume-expansion VolumeExpansion mycluster Succeed 3/3 6m
If an error occurs, you can troubleshoot with kubectl describe ops -n demo command to view the events of this operation.
Check whether the corresponding cluster resources change.
kubectl describe cluster mycluster -n demo
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 values of spec.componentSpecs.volumeClaimTemplates.spec.resources.
...
spec:
clusterDefinitionRef: starrocks-ce
clusterVersionRef: starrocks-ce-3.1.1
componentSpecs:
- name: be
componentDefRef: be
volumeClaimTemplates:
- name: be-storage
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 40Gi # Change the volume storage size
...
Check whether the corresponding cluster resources change.
kubectl describe cluster mycluster -n demo
Set the --storage value according to your need and run the command to expand the volume.
kbcli cluster volume-expand mycluster -n demo --storage=40Gi --components=be
The volume expansion may take a few minutes.
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-5pbd2 -n demo
View the cluster status.
kbcli cluster list mycluster -n demo
>
NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
mycluster demo starrocks starrocks-3.1.1 Delete Running Jul 17,2024 19:06 UTC+0800
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