KubeBlocks
BlogsKubeBlocks Cloud
⌘K
​
Starrocks
Provision
Scale
Stop/Start
Restart
Expand Volume
Delete
  1. Stop/Start a cluster
    1. Stop a cluster
    2. Start a cluster

Stop/Start a cluster

You can stop/start a cluster to save computing resources. When a cluster is stopped, the computing resources of this cluster are released, which means the pods of Kubernetes are released, but the storage resources are reserved. You can start this cluster again by snapshots if you want to restore the cluster resources.

Stop a cluster

  1. Configure the name of your cluster and run the command below to stop this cluster.

    Apply an OpsRequest to restart a cluster.

    kubectl apply -f - <<EOF
    apiVersion: apps.kubeblocks.io/v1alpha1
    kind: OpsRequest
    metadata:
      name: mycluster-stop
      namespace: demo
    spec:
      clusterName: mycluster
      type: Stop
    EOF
    
    kubectl edit cluster mycluster -n demo
    

    Configure replicas as 0 to delete pods.

    ...
    spec:
      clusterDefinitionRef: starrocks-ce
      clusterVersionRef: starrocks-ce-3.1.1
      terminationPolicy: Delete
      affinity:
        podAntiAffinity: Preferred
        topologyKeys:
        - kubernetes.io/hostname
      tolerations:
        - key: kb-data
          operator: Equal
          value: 'true'
          effect: NoSchedule
      componentSpecs:
      - name: fe
        componentDefRef: fe
        serviceAccountName: kb-starrocks-cluster
        replicas: 0 # Change this value
      - name: be
        componentDefRef: be
        replicas: 0 # Change this value
    
    kbcli cluster stop mycluster -n demo
    
  2. Check the status of the cluster to see whether it is stopped.

    kubectl get cluster mycluster -n demo
    
    kbcli cluster list mycluster -n demo
    

Start a cluster

  1. Configure the name of your cluster and run the command below to start this cluster.

    Apply an OpsRequest to start a cluster.

    kubectl apply -f - <<EOF
    apiVersion: apps.kubeblocks.io/v1alpha1
    kind: OpsRequest
    metadata:
      name: ops-start
      namespace: demo
    spec:
      clusterName: mycluster
      type: Start
    EOF
    
    kubectl edit cluster mycluster -n demo
    

    Change replicas back to the original amount to start this cluster again.

    spec:
      clusterDefinitionRef: starrocks-ce
      clusterVersionRef: starrocks-ce-3.1.1
      terminationPolicy: Delete
      affinity:
        podAntiAffinity: Preferred
        topologyKeys:
        - kubernetes.io/hostname
      tolerations:
        - key: kb-data
          operator: Equal
          value: 'true'
          effect: NoSchedule
      componentSpecs:
      - name: fe
        componentDefRef: fe
        serviceAccountName: kb-starrocks-cluster
        replicas: 1 # Change this value
      - name: be
        componentDefRef: be
        replicas: 2 # Change this value
    
    kbcli cluster start mycluster -n demo
    
  2. Check the status of the cluster to see whether it is running again.

    kubectl get cluster mycluster -n demo
    
    kbcli cluster list mycluster -n demo
    

© 2025 ApeCloud PTE. Ltd.