KubeBlocks
BlogsEnterprise
⌘K
​
Blogs

Overview
Quickstart
Architecture

Operations

Stop / Start / Restart
Vertical Scaling
Horizontal Scaling
Volume Expansion
Reconfigure
Manage Services

Observability

Prometheus Integration
  1. Prerequisites
  2. Scale Out the NameServer
  3. Scale In the NameServer
  4. Cleanup

Horizontal Scaling for RocketMQ

Horizontal scaling changes the number of pod replicas for a component. KubeBlocks supports scaling the NameServer component. Broker scaling uses the sharding model (see note below).

Prerequisites

    Before proceeding, verify your environment meets these requirements:

    • A functional Kubernetes cluster (v1.21+ recommended)
    • kubectl v1.21+ installed and configured with cluster access
    • Helm installed (installation guide)
    • KubeBlocks installed (installation guide)
    • RocketMQ Add-on installed and a RocketMQ cluster running (see Quickstart)

    Scale Out the NameServer

    Add one more NameServer replica:

    kubectl apply -f - <<EOF apiVersion: operations.kubeblocks.io/v1alpha1 kind: OpsRequest metadata: name: rocketmq-name-server-scale-out namespace: demo spec: clusterName: rocketmq-cluster type: HorizontalScaling horizontalScaling: - componentName: namesrv scaleOut: replicaChanges: 1 EOF

    Monitor progress:

    kubectl get opsrequest rocketmq-name-server-scale-out -n demo -w
    Example Output
    NAME TYPE CLUSTER STATUS PROGRESS AGE rocketmq-name-server-scale-out HorizontalScaling rocketmq-cluster Succeed 1/1 30s

    Verify the new replica count:

    kubectl get pods -n demo -l app.kubernetes.io/instance=rocketmq-cluster \ -l apps.kubeblocks.io/component-name=namesrv
    Example Output
    NAME READY STATUS RESTARTS AGE rocketmq-cluster-namesrv-0 2/2 Running 0 10m rocketmq-cluster-namesrv-1 2/2 Running 0 1m

    Scale In the NameServer

    Remove one NameServer replica:

    kubectl apply -f - <<EOF apiVersion: operations.kubeblocks.io/v1alpha1 kind: OpsRequest metadata: name: rocketmq-name-server-scale-in namespace: demo spec: clusterName: rocketmq-cluster type: HorizontalScaling horizontalScaling: - componentName: namesrv scaleIn: replicaChanges: 1 EOF

    Monitor progress:

    kubectl get opsrequest rocketmq-name-server-scale-in -n demo -w
    Example Output
    NAME TYPE CLUSTER STATUS PROGRESS AGE rocketmq-name-server-scale-in HorizontalScaling rocketmq-cluster Succeed 1/1 25s
    NOTE

    Broker shards cannot be scaled via HorizontalScaling OpsRequest. To add more broker capacity, change shards in the Cluster spec directly. Increasing replicas within a shard (master + slave) must also be done via the Cluster spec, not OpsRequest.

    Cleanup

    kubectl delete opsrequest rocketmq-name-server-scale-out rocketmq-name-server-scale-in -n demo --ignore-not-found

    © 2026 KUBEBLOCKS INC