Skip to main content
When the traffic handled by your Pulsar cluster increases or decreases, you can scale out or scale in the cluster accordingly. Depending on the specific use case, you may choose to increase or decrease the number of nodes for different components, including Pulsar brokers, Pulsar proxies, bookies, and ZooKeeper. When resizing the Pulsar cluster on Kubernetes created by the Pulsar Operators, you need to perform the scaling action on Custom Resources (CRs) instead of the individual workloads deployed through them. For example, when deploying Pulsar broker workloads, the Pulsar Operators create a broker StatefulSet with 2 Pod replicas by default. To scale the StatefulSet, you should adjust the broker CR instead of manually changing the StatefulSet. This document describes how to manually scale Pulsar components on Kubernetes.

Prerequisites

You have deployed a Pulsar cluster using the Pulsar Operators.

Scale Pulsar brokers

If you use the default broker CR, you should have 2 broker replicas running in the pulsar namespace. This example scales the number of Pods from 2 to 5.
  1. View the existing broker CR.
    You should see the following output:
  2. Run the following command to scale brokers.
  3. View the newly-created Pods.
    You should see the following output:
  4. Alternatively, you can create a broker YAML file with the following configuration and use the kubectl apply -f command to apply the file.

Scale Pulsar proxies

If you use the default proxy CR, you should have 2 proxy replicas running in the pulsar namespace. This example scales the number of Pods from 2 to 5.
  1. View the existing proxy CR.
    You should see the following output:
  2. Run the following command to scale Pulsar proxies.
  3. View the newly created Pods.
    You should see the following output:
  4. Alternatively, you can create a proxy YAML file with the following configuration and use the kubectl apply -f command to apply the file.

Scale bookies

If you use the default BookKeeper CR, you should have 3 bookie replicas running in the pulsar namespace. This example scales the number of bookie Pods from 3 to 7.
  1. View the existing BookKeeper CR.
    You should see the following output:
  2. Run the following command to scale bookies.
  3. View the newly-created Pods.
    You should see the following output:
  4. Alternatively, you can create a BookKeeper YAML file with the following configuration and use the kubectl apply -f command to apply the file.

Scale ZooKeeper

If you use the default ZooKeeper CR, you should have 3 ZooKeeper replicas running in the pulsar namespace. This example scales the number of Pods from 3 to 5.
  1. View the existing ZooKeeper CR.
    You should see the following output:
  2. Run the following command to scale ZooKeeper.
  3. View the newly-created Pods.
    You should see the following output:
  4. Alternatively, you can create a ZooKeeper YAML file with the following configuration and use the kubectl apply -f command to apply the file.