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

Before you start

  • Install kbcli if you want to manage the StarRocks cluster with kbcli.

  • Install KubeBlocks.

  • Install and enable the starrocks Addon.

  • To keep things isolated, create a separate namespace called demo throughout this tutorial.

    kubectl create namespace demo
    

Create a cluster

KubeBlocks implements a Cluster CRD to define a cluster. Here is an example of creating a StarRocks cluster. If you only have one node for deploying a cluster with multiple replicas, configure the cluster affinity by setting spec.schedulingPolicy or spec.componentSpecs.schedulingPolicy. For details, you can refer to the API docs. But for a production environment, it is not recommended to deploy all replicas on one node, which may decrease the cluster availability.

cat <<EOF | kubectl apply -f -
apiVersion: apps.kubeblocks.io/v1
kind: Cluster
metadata:
  name: mycluster
  namespace: demo
spec:
  terminationPolicy: Delete
  componentSpecs:
  - name: fe
    componentDef: starrocks-ce-fe
    serviceAccountName: kb-starrocks-cluster
    replicas: 1
    resources:
      limits:
        cpu: '1'
        memory: 1Gi
      requests:
        cpu: '1'
        memory: 1Gi
  - name: be
    componentDef: starrocks-ce-be
    replicas: 2
    resources:
      limits:
        cpu: '1'
        memory: 1Gi
      requests:
        cpu: '1'
        memory: 1Gi
    volumeClaimTemplates:
    - name: data
      spec:
        accessModes:
        - ReadWriteOnce
        resources:
          requests:
            storage: 20Gi
EOF
FieldDefinition
spec.terminationPolicyIt is the policy of cluster termination. Valid values are DoNotTerminate, Delete, WipeOut. For the detailed definition, you can refer to Termination Policy.
spec.componentSpecsIt is the list of ClusterComponentSpec objects that define the individual Components that make up a Cluster. This field allows customized configuration of each component within a cluster. Note: shardingSpecs and componentSpecs cannot both be empty; at least one must be defined to configure a cluster. ClusterComponentSpec defines the specifications for a Component in a Cluster.
spec.componentSpecs.replicasIt specifies the number of replicas of the component.
spec.componentSpecs.resourcesIt specifies the resources required by the Component.
spec.componentSpecs.volumeClaimTemplatesIt specifies a list of PersistentVolumeClaim templates that define the storage requirements for the Component.
spec.componentSpecs.volumeClaimTemplates.nameIt refers to the name of a volumeMount defined in componentDefinition.spec.runtime.containers[*].volumeMounts.
spec.componentSpecs.volumeClaimTemplates.spec.storageClassNameIt is the name of the StorageClass required by the claim. If not specified, the StorageClass annotated with storageclass.kubernetes.io/is-default-class=true will be used by default.
spec.componentSpecs.volumeClaimTemplates.spec.resources.storageYou can set the storage size as needed.

For more API fields and descriptions, refer to the API Reference.

KubeBlocks operator watches for the Cluster CRD and creates the cluster and all dependent resources. You can get all the resources created by the cluster with kubectl get all,secret,rolebinding,serviceaccount -l app.kubernetes.io/instance=mycluster -n demo.

kubectl get all,secret,rolebinding,serviceaccount -l app.kubernetes.io/instance=mycluster -n demo

Run the following command to see the created StarRocks cluster object:

kubectl get cluster mycluster -n demo -o yaml

© 2025 ApeCloud PTE. Ltd.