Broker Pools

Use the RedpandaBrokerPool custom resource (CR) to manage a group of brokers in a cluster separately from the others. Each broker pool has its own StatefulSet, so you choose which Kubernetes nodes its brokers run on and when you add or remove them. Use broker pools to move brokers to new nodes without downtime, to move brokers to larger nodes, or to run brokers on different hardware.

After reading this page, you will be able to:

  • Describe what RedpandaBrokerPool resources are and when to use them

  • Enable broker pools on the Redpanda Operator

  • Create a RedpandaBrokerPool to manage a group of brokers

This feature requires an Enterprise Edition license for the Redpanda Operator. The operator can manage many clusters, so it needs its own license. It reads the license from the Secret that the operator chart’s enterprise.licenseSecretRef names. The built-in trial license of a new Redpanda cluster doesn’t apply, and the clusters that the operator manages are licensed separately. To get a trial license key, generate a new trial license key. To purchase a license, contact Redpanda Sales. See also Redpanda Operator enterprise features.

In Redpanda Operator v26.3 and later, the NodePool resource is deprecated in favor of RedpandaBrokerPool and will be removed in a future release. Existing NodePools keep working. To move a NodePool’s brokers to a RedpandaBrokerPool without restarting them, see Migrate from a NodePool to a RedpandaBrokerPool.

How broker pools work

A RedpandaBrokerPool is a Kubernetes custom resource (cluster.redpanda.com/v1alpha2, kind: RedpandaBrokerPool) that defines a group of Redpanda brokers with shared configuration. Each broker pool:

  • Creates and manages its own StatefulSet.

  • Names Pods after the cluster and the pool. For example, a broker pool named pool1 with three replicas in a cluster named redpanda creates Pods redpanda-pool1-0, redpanda-pool1-1, and redpanda-pool1-2.

  • Can target specific Kubernetes nodes using a node selector and tolerations in spec.podTemplate.

  • Specifies its own replica count independent of other pools. If you don’t set spec.replicas, a pool of a Redpanda resource has three brokers.

When broker pools manage every broker, set statefulset.replicas to 0 in the Redpanda CR, so that the broker pools set how many brokers run. On an existing cluster, create the broker pool and wait for its brokers to join the cluster first. See Migrate an existing cluster to broker pools.

The same resource also defines the broker groups of a Stretch Cluster. Some fields apply only to a pool of a StretchCluster: clusterDomain, tls, external, listeners, rbac, serviceAccount, monitoring, storage, resources, imagePullSecrets, rackAwareness, and logging. The operator rejects a pool of a Redpanda resource that sets any of them. For a pool of a Redpanda resource, set these values on the Redpanda resource instead.

When to use broker pools

Broker pools are useful when you need to:

  • Migrate brokers to new nodes: Perform blue/green migrations by creating a new broker pool on the target node pool, then scaling down the old broker pool. The Redpanda Operator handles decommissioning automatically. See Migrate Node Pools.

  • Scale vertically: Move brokers to nodes with more CPU, memory, or storage without manual decommission and re-provision steps.

  • Upgrade Kubernetes: Migrate to a new Kubernetes node pool running a newer version while maintaining cluster availability.

Always scale up before scaling down

Never create and delete broker pools at the same time. Kubernetes doesn’t apply changes immediately, so doing both together can delete and recreate the cluster. Wait until the new broker pool is stable before you remove the old one.

When you migrate between broker pools, scale up the new pool first. Check that all of its brokers are healthy before you scale down or delete the old pool. You can do this in either of two ways:

  • Big bang: Create all replicas in the new broker pool, wait for the cluster to stabilize with twice the usual broker count, then delete the old broker pool. Migrate Node Pools uses this approach.

  • Incremental: Scale the new broker pool up by one broker, wait for it to join and stabilize, then scale the old broker pool down by one broker. Repeat until all brokers have migrated. This approach uses fewer temporary resources but takes longer.

Before each scale-down step, run rpk cluster health and check that the cluster has zero leaderless and zero under-replicated partitions.

Prerequisites

Enable broker pools

If the cluster has NodePools, keep the experimental CRDs and the --enable-v2-nodepools flag in the operator values until you’ve moved every NodePool to a RedpandaBrokerPool and deleted it. The flag goes in additionalCmdFlags:

crds:
  enabled: true
  experimental: true
additionalCmdFlags:
  - "--enable-v2-nodepools"

Without the flag, the operator ignores NodePools, treats their StatefulSets as pools that should no longer exist, and decommissions their brokers, which can lose data. See Migrate from a NodePool to a RedpandaBrokerPool.

After a RedpandaBrokerPool owns a pool, don’t downgrade the operator below v26.3. This applies to pools you create with a RedpandaBrokerPool and to pools handed over from a NodePool. An older operator doesn’t recognize RedpandaBrokerPools and removes the StatefulSets of their pools.
  1. Store your license in a Secret in the operator’s namespace:

    kubectl create secret generic redpanda-license \
      --from-file=license=<path-to-license-file> \
      --namespace <operator-namespace>
  2. Configure the Redpanda Operator Helm values with the license:

    operator-values.yaml
    crds:
      enabled: true
    enterprise:
      licenseSecretRef: (1)
        name: redpanda-license
        key: license
    1 Mounts the license Secret into the operator Pod.
  3. Deploy or upgrade the operator with these values:

    helm upgrade --install redpanda-controller redpanda/operator \
      --namespace <operator-namespace> --create-namespace \
      --values operator-values.yaml
  4. In the Redpanda CR, set statefulset.replicas to 0, so that broker pools manage the brokers.

    On an existing cluster, don’t set replicas to 0 yet. Create the broker pool and wait for its brokers to join the cluster first, or you lose all the data in the existing cluster. See Migrate an existing cluster to broker pools.
    redpanda-cr.yaml
    apiVersion: cluster.redpanda.com/v1alpha2
    kind: Redpanda
    metadata:
      name: redpanda
      namespace: <namespace>
    spec:
      clusterSpec:
        image:
          tag: v26.3.1 (1)
        statefulset:
          replicas: 0 (2)
          budget:
            maxUnavailable: 1
        resources:
          cpu:
            cores: 1
          memory:
            container:
              max: 2Gi
        storage:
          persistentVolume:
            enabled: true
            size: 5Gi
            storageClass: premium-rwo
    1 The Redpanda version for the cluster. Broker pools that don’t set spec.image.tag inherit this tag.
    2 With replicas set to 0, broker pools manage the brokers.

What happens without a license

The operator needs a valid Enterprise Edition license to manage a RedpandaBrokerPool. Without one, the broker pool reports Deployed=False with reason LicenseInvalid. For any cluster that has a pool owned by a RedpandaBrokerPool, the operator then:

  • Applies no changes to the cluster’s resources or pools.

  • Never removes the pool.

  • Still recovers failed brokers if the cluster runs on StatefulSets. If the cluster uses Broker resources, the operator does not replace a broker whose disk was lost until you configure a license.

Create a broker pool

Define a RedpandaBrokerPool that specifies the number of replicas and the target Kubernetes nodes:

brokerpool-pool1.yaml
apiVersion: cluster.redpanda.com/v1alpha2
kind: RedpandaBrokerPool
metadata:
  name: pool1
  namespace: <namespace>
spec:
  clusterRef:
    name: redpanda (1)
  replicas: 3
  podTemplate:
    spec:
      nodeSelector:
        nodetype: redpanda-pool1 (2)
      tolerations:
        - key: redpanda-pool1 (3)
          operator: Equal
          value: "true"
          effect: NoSchedule
1 The name of the Redpanda resource. The Redpanda resource must be in the same namespace as the broker pool. clusterRef.kind defaults to Redpanda.
2 Targets Kubernetes nodes labeled nodetype: redpanda-pool1.
3 Allows scheduling on nodes tainted with redpanda-pool1=true:NoSchedule.

Apply the broker pool:

kubectl apply -f brokerpool-pool1.yaml

Verify that the brokers are running:

kubectl get pods -n <namespace> -l app.kubernetes.io/name=redpanda

Control node placement with nodeSelector and tolerations

Use a node selector and tolerations together, so that a broker pool’s brokers run only on the Kubernetes nodes you choose. All brokers in the pool then run on the same hardware, and other workloads can’t use those nodes.

How it works

Set both in spec.podTemplate.spec. The operator merges that section into the Pod template it creates for the pool.

nodeSelector

Limits Pods to Kubernetes nodes with a matching label. Kubernetes schedules the pool’s brokers only on nodes that have the label.

tolerations

Lets Pods run on nodes that have a matching taint. When you taint nodes with NoSchedule, only Pods with a matching toleration can run there.

Together, these fields keep the pool and its nodes to themselves:

  • The nodeSelector keeps the pool’s brokers on the labeled nodes.

  • The NoSchedule taint keeps other workloads off those nodes.

Use both when all brokers in a pool must run on the same hardware, such as one machine type in a cloud provider’s Kubernetes node pool.

Label and taint your Kubernetes nodes

Before creating a broker pool, label and taint the target Kubernetes nodes. Each cloud provider handles this differently when you create a node pool:

  • GKE

  • EKS

  • AKS

gcloud container node-pools create redpanda-pool1 \
  --cluster <cluster-name> \
  --machine-type e2-standard-8 \
  --node-labels nodetype=redpanda-pool1 \
  --node-taints redpanda-pool1=true:NoSchedule
eksctl create nodegroup \
  --cluster <cluster-name> \
  --name redpanda-pool1 \
  --node-type m5.2xlarge \
  --node-labels nodetype=redpanda-pool1 \
  --node-taints redpanda-pool1=true:NoSchedule
az aks nodepool add \
  --resource-group <resource-group> \
  --cluster-name <cluster-name> \
  --name rppool1 \
  --node-vm-size Standard_D8s_v3 \
  --labels nodetype=redpanda-pool1 \
  --node-taints redpanda-pool1=true:NoSchedule

For existing nodes, you can apply labels and taints manually:

kubectl label nodes <node-name> nodetype=redpanda-pool1
kubectl taint nodes <node-name> redpanda-pool1=true:NoSchedule

Configure the broker pool

Reference the labels and taints in your broker pool:

apiVersion: cluster.redpanda.com/v1alpha2
kind: RedpandaBrokerPool
metadata:
  name: pool1
  namespace: <namespace>
spec:
  clusterRef:
    name: redpanda
  replicas: 3
  podTemplate:
    spec:
      nodeSelector:
        nodetype: redpanda-pool1 (1)
      tolerations:
        - key: redpanda-pool1 (2)
          operator: Equal
          value: "true"
          effect: NoSchedule
1 Must match the label applied to the target Kubernetes nodes.
2 Must match the taint key, value, and effect on the target Kubernetes nodes.

Verify node placement

After applying the broker pool, confirm that all Pods are running on the expected nodes:

kubectl get pods -n <namespace> -o wide -l app.kubernetes.io/name=redpanda

The NODE column shows only nodes from the target Kubernetes node pool.

Migrate from a NodePool to a RedpandaBrokerPool

If you manage brokers with a NodePool, you can hand its pool to a RedpandaBrokerPool. The StatefulSet and its brokers stay in place, and no broker restarts.

  1. Make sure the operator runs v26.3 or later with an Enterprise Edition license, and keep the experimental CRDs (crds.experimental: true) and the --enable-v2-nodepools flag that your NodePool uses. The operator needs both to hand the pool over. Don’t remove them until every NodePool’s pool belongs to a RedpandaBrokerPool and you’ve deleted the NodePools. Otherwise the operator decommissions the brokers of the NodePools that are left. See Enable broker pools.

    If the operator has no license when it takes over the pool, it applies no changes to the cluster until you add one. See What happens without a license.
  2. Create a RedpandaBrokerPool with the same name, namespace, clusterRef, and spec as the NodePool. For example, for a NodePool named blue:

    brokerpool-blue.yaml
    apiVersion: cluster.redpanda.com/v1alpha2
    kind: RedpandaBrokerPool
    metadata:
      name: blue (1)
      namespace: <namespace>
    spec: (2)
      clusterRef:
        name: redpanda
      replicas: 3
    1 Must match the NodePool’s name.
    2 Copy every field of the NodePool’s spec. If you don’t set replicas, the broker pool defaults to three brokers.
    kubectl apply -f brokerpool-blue.yaml

    Until you hand over the pool, the NodePool keeps managing it, and the RedpandaBrokerPool changes nothing.

  3. Check whether the two specs match:

    kubectl get redpandabrokerpool blue -n <namespace> \
      -o jsonpath='{.status.conditions[?(@.type=="Deployed")]}'

    The Deployed condition is False with reason SupersededByNodePool. Its message says that the specs match, or names the fields that differ. If the operator has no license, the reason is LicenseInvalid instead, and the message doesn’t compare the specs. Add the license first. See What happens without a license. If the specs differ, update the RedpandaBrokerPool until the message says the specs match. If you hand over the pool while the specs differ, the operator applies the differences when the RedpandaBrokerPool takes over. For example, it scales the pool if replicas differs.

  4. Hand over the pool by annotating the NodePool:

    kubectl annotate nodepool blue -n <namespace> \
      operator.redpanda.com/migrate-to-broker-pool="true"

    Deleting the NodePool also hands over the pool, but only if the RedpandaBrokerPool already exists. If you delete a NodePool that has no matching RedpandaBrokerPool, the operator decommissions its brokers.

  5. Verify the handover:

    kubectl get redpandabrokerpool blue -n <namespace>

    The DEPLOYED column shows True. The NodePool’s Deployed condition message says that the pool is owned by the RedpandaBrokerPool.

  6. Delete the NodePool:

    kubectl delete nodepool blue -n <namespace>

    After the handover, deleting the NodePool leaves the pool and its brokers in place.

If the cluster uses Broker resources, the operator updates each Broker’s clusterRef to name the RedpandaBrokerPool during the handover.

After a RedpandaBrokerPool takes a pool and you delete the NodePool, don’t downgrade the operator below v26.3. An older operator removes that pool’s StatefulSet. See Enable broker pools.

Migrate an existing cluster to broker pools

If the Redpanda Operator manages your cluster without broker pools, move the brokers into a broker pool before you run a blue/green migration. The move has no downtime.

The broker pool doesn’t take over the existing brokers. It creates new brokers that join the cluster. Then you remove the existing brokers, and the operator decommissions them and moves their partitions to the broker pool’s brokers. For a while, the cluster runs twice the usual number of brokers, so your Kubernetes nodes need room for them.

If your Kubernetes nodes don’t have room for twice the brokers, move one broker at a time instead. Create the broker pool with one broker, wait for the cluster to be healthy, then reduce statefulset.replicas by one. Repeat, adding one broker to the broker pool each time, until statefulset.replicas is 0.

Create the broker pool and wait for its brokers to join the cluster before you set statefulset.replicas to 0. If you set replicas to 0 first, the broker pool’s brokers start a new, empty cluster, and the operator removes the existing brokers. All data in the existing cluster is lost.

Verify cluster health

Confirm the existing cluster is healthy before making changes:

rpk cluster health
rpk cluster info

Note the number of brokers and the cluster UUID. You need the number of brokers for the broker pool’s replicas field, and the UUID to confirm that the broker pool’s brokers join this cluster.

Enable broker pools on the operator

If you haven’t already, upgrade the Redpanda Operator with a license. Follow the steps in Enable broker pools, but stop before the step that sets statefulset.replicas to 0.

Create a broker pool

Create a broker pool with the same number of brokers as your current cluster. Use a node selector and tolerations for the nodes that the broker pool’s brokers should run on:

brokerpool-pool1.yaml
apiVersion: cluster.redpanda.com/v1alpha2
kind: RedpandaBrokerPool
metadata:
  name: pool1
  namespace: <namespace>
spec:
  clusterRef:
    name: redpanda
  replicas: 3 (1)
  podTemplate:
    spec:
      nodeSelector:
        nodetype: redpanda-pool1 (2)
      tolerations:
        - key: redpanda-pool1 (3)
          operator: Equal
          value: "true"
          effect: NoSchedule
1 Set to the number of brokers in your existing cluster.
2 Replace with the label on the Kubernetes nodes for the broker pool.
3 Replace with the taint key on the Kubernetes nodes for the broker pool.

Apply the broker pool:

kubectl apply -f brokerpool-pool1.yaml

Wait for the broker pool’s brokers to join

Wait until all brokers are healthy:

rpk cluster health
Expected output (6 brokers)
CLUSTER HEALTH OVERVIEW
=======================
Healthy:                          true
Unhealthy reasons:                []
Controller ID:                    0
All nodes:                        [0 1 2 3 4 5]
Nodes down:                       []
Nodes in recovery mode:           []
Nodes with high disk usage:       []
Leaderless partitions (0):        []
Under-replicated partitions (0):  []
Cluster UUID:                     8d2e5eac-d844-4563-8e1d-01696f91b245

The cluster UUID is the same as before, and the cluster has twice the usual number of brokers. Don’t continue until the cluster reports healthy with all brokers online.

Remove the existing brokers

Patch the Redpanda CR to set statefulset.replicas to 0:

cat <<EOF > patch-replicas.yaml
spec:
  clusterSpec:
    statefulset:
      replicas: 0
EOF
kubectl patch redpanda redpanda -n <namespace> --type merge --patch-file patch-replicas.yaml

The operator decommissions the existing brokers one at a time and moves their partitions to the broker pool’s brokers. Monitor the progress:

rpk cluster info -b --detailed

Wait until only the broker pool’s brokers remain.

Verify the migration

Confirm the broker pool is deployed:

kubectl get redpandabrokerpool -n <namespace>

Verify the brokers are healthy:

rpk cluster health
rpk cluster info

The cluster has the same UUID and the same number of healthy brokers as before. The broker pool now manages the cluster, which is ready for blue/green migrations.

By default, the operator keeps the PersistentVolumeClaims (PVCs) of removed brokers, so that it never deletes data by mistake. After you verify the migration, delete them:

kubectl delete pvc datadir-redpanda-0 datadir-redpanda-1 datadir-redpanda-2 -n <namespace>

To have Kubernetes delete each broker’s PVC when the operator removes the broker, set persistentVolumeClaimRetentionPolicy.whenScaled to Delete before you set replicas to 0. On the Redpanda CR, the field is spec.clusterSpec.statefulset.persistentVolumeClaimRetentionPolicy. On a broker pool, it’s spec.persistentVolumeClaimRetentionPolicy. Whether the PersistentVolume is also deleted depends on the reclaim policy of its StorageClass.

Remove broker pools and return to operator-managed replicas

If you no longer need broker pools, you can move the brokers back to the default StatefulSet that the Redpanda CR manages. You restore the replica count in the Redpanda CR, wait for the new brokers to stabilize, and then delete the broker pool. The operator decommissions the broker pool’s brokers one at a time.

Restore replicas in the Redpanda CR

Set statefulset.replicas in the Redpanda CR back to the desired broker count. For example, if your broker pool has three replicas, set the Redpanda CR to 3:

cat <<EOF > patch-replicas.yaml
spec:
  clusterSpec:
    statefulset:
      replicas: 3
EOF
kubectl patch redpanda redpanda -n <namespace> --type merge --patch-file patch-replicas.yaml

The operator creates new brokers in the default StatefulSet. For a while, the cluster runs twice the usual number of brokers. For example, it runs six brokers: three from the broker pool and three from the Redpanda CR.

Wait for all brokers to stabilize

Wait until all brokers are healthy and data is fully replicated across the cluster:

rpk cluster health
rpk cluster info
Expected output (6 brokers)
CLUSTER HEALTH OVERVIEW
=======================
Healthy:                          true
Unhealthy reasons:                []
Controller ID:                    0
All nodes:                        [0 1 2 3 4 5]
Nodes down:                       []
Nodes in recovery mode:           []
Nodes with high disk usage:       []
Leaderless partitions (0):        []
Under-replicated partitions (0):  []
Cluster UUID:                     8d2e5eac-d844-4563-8e1d-01696f91b245

Don’t continue until the cluster reports healthy with all brokers online.

Delete the broker pool

Delete the broker pool. The operator decommissions its brokers one at a time and moves their partitions to the brokers that the Redpanda CR manages:

kubectl delete redpandabrokerpool pool1 -n <namespace>

Monitor the decommission progress:

rpk cluster info -b --detailed

Wait until only the brokers that the Redpanda CR manages remain.

The operator keeps the broker pool’s PVCs. After you verify the cluster, delete them:

kubectl delete pvc datadir-redpanda-pool1-0 datadir-redpanda-pool1-1 datadir-redpanda-pool1-2 -n <namespace>

If the broker pool sets spec.persistentVolumeClaimRetentionPolicy.whenScaled to Delete, Kubernetes deletes each PVC when the operator removes the broker, and you don’t need to delete them.

Verify the cluster

Confirm that the cluster is healthy and running only the expected brokers:

rpk cluster health
rpk cluster info

The Redpanda CR now manages the whole cluster, without broker pools.

Cluster maintenance

For ongoing management of brokers in your cluster, see:

Suggested reading