Scaling the Broker Cluster

Scale the MQTT broker cluster up, down, or to zero.

Scaling the broker cluster allows you to adjust the number of broker replicas in your Kubernetes deployment, either by adding (scaling up) or removing (scaling down) broker nodes.

Scaling the Broker Cluster Up or Down

Prerequisites

Procedure

  1. Check how many replicas are currently set for the broker StatefulSet:

kubectl get sts broker -n ${CONNECTWARE_NAMESPACE}

Example output

NAME     READY   AGE
broker   3/3     6m52s
  1. Scale the StatefulSet to the desired number of replicas.

  • To scale up (add brokers), increase the replica count. For example, to scale up from 2 to 3 replicas:

kubectl scale sts broker -n ${CONNECTWARE_NAMESPACE} --replicas 3
  • To scale down (remove brokers), decrease the replica count. For example, to scale down from 3 to 2 replicas:

  1. Verify that all broker nodes have formed a healthy cluster:

Scaling Down the Broker Cluster to Zero

Prerequisites

Procedure

  1. Check how many replicas are currently set for the broker StatefulSet:

Example output

  1. Set the number of broker replicas to zero to remove all broker pods:

  1. Verify that all broker pods have been terminated:

Last updated

Was this helpful?