Migrate Node Pools
Move Redpanda brokers to a new Kubernetes node pool with no downtime, using the RedpandaBrokerPool custom resource (CR). You create new (green) brokers on the target node pool. When they have the data, you delete the old (blue) brokers, and the Redpanda Operator decommissions them for you.
After reading this page, you will be able to:
-
Perform a blue/green node pool migration using broker pools
-
Verify cluster health and data integrity before and after migration
Use this approach to upgrade Redpanda, change node instance types, move brokers to larger nodes, or upgrade Kubernetes nodes. For the manual method that doesn’t use broker pools, see Migrate Node Pools Manually.
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. If your cluster runs on a NodePool, first hand its pool to a RedpandaBrokerPool. The handover doesn’t restart brokers. |
How it works
A blue/green migration has these stages:
-
You verify that the existing (blue) broker pool is healthy.
-
You create a new (green) broker pool with the target Redpanda version. You can pin it to specific Kubernetes nodes with a node selector and tolerations.
-
The green brokers join the cluster and start replicating data. For a while, the cluster runs twice the usual number of brokers.
-
You delete the old (blue) broker pool. The operator decommissions the blue brokers one at a time and moves their partitions to the green brokers.
-
Only green brokers remain. You clean up the old Kubernetes node pool.
During the migration, both broker pools serve traffic. You don’t run any decommission commands. Deleting the old broker pool is enough.
If a broker pool doesn’t set repository or tag in spec.image, it takes that field from spec.clusterSpec.image on the Redpanda CR. If the Redpanda CR doesn’t set it either, the broker pool uses the operator’s default. To run the green brokers on a different Redpanda version than the blue brokers, set spec.image.tag on the green broker pool.
|
Prerequisites
-
Broker pools: A Redpanda cluster managed by the Redpanda Operator v26.3 or later with broker pools, and an existing (blue) RedpandaBrokerPool. See Broker Pools, including how to migrate an existing cluster to broker pools.
-
Enterprise Edition license for the operator: The operator needs its own license. The built-in trial license of a Redpanda cluster doesn’t apply. See Redpanda Operator enterprise features.
-
Replica count:
statefulset.replicasset to0in the Redpanda CR, so that broker pools set how many brokers run. -
Target nodes: To pin brokers to specific Kubernetes nodes, a new Kubernetes node pool in your hosting platform (GKE, EKS, AKS, or self-managed) with nodes that meet Redpanda requirements. See Control node placement with nodeSelector and tolerations.
-
Staging environment: A place to test the migration before you run it in production.
-
Compatible versions: A target Redpanda version that’s compatible with your operator version. See Kubernetes Compatibility.
Pre-migration considerations
Before you migrate, consider:
-
Cost: During the migration, the cluster runs twice the usual number of brokers. Plan for higher infrastructure costs while it runs.
-
Data volume: Decommissioning time depends on the amount of data to replicate. With a lot of data, each broker can take hours.
-
Replication factor: To keep topics available during decommissioning, run more brokers than your highest topic replication factor.
-
Partition count: The number of partitions a cluster can hold depends mostly on its total CPU cores. Check that the new nodes can handle the partitions.
-
Image tag: Set
spec.image.tagon the green broker pool to the target version. Without it, the green broker pool inherits the image from the Redpanda CR.
Verify the blue broker pool
Before you start, check that the existing blue broker pool is running and healthy. This example upgrades Redpanda from v26.2.6 to v26.2.7.
Check the broker pool status:
kubectl get redpandabrokerpool -n <namespace>
Expected output
NAME BOUND DEPLOYED
blue True True
Verify the broker pool conditions:
kubectl describe redpandabrokerpool blue -n <namespace>
Confirm that the conditions show Bound=True, Deployed=True, and Stable=True.
Verify the Pods are running:
kubectl get pods -n <namespace> -l app.kubernetes.io/name=redpanda -o wide
Expected output
NAME READY STATUS RESTARTS AGE IP NODE
redpanda-blue-0 2/2 Running 0 24h 10.244.1.5 worker-1
redpanda-blue-1 2/2 Running 0 24h 10.244.2.5 worker-2
redpanda-blue-2 2/2 Running 0 24h 10.244.3.5 worker-3
Check cluster health:
kubectl exec -n <namespace> redpanda-blue-0 -c redpanda -- rpk cluster health
Expected output
CLUSTER HEALTH OVERVIEW
=======================
Healthy: true
Unhealthy reasons: []
Controller ID: 0
All nodes: [0 1 2]
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
List the brokers and confirm their current version:
kubectl exec -n <namespace> redpanda-blue-0 -c redpanda -- rpk cluster info -b --detailed
Expected output
BROKERS
=======
ID HOST PORT CORES MEMBERSHIP IS-ALIVE VERSION UUID
0* redpanda-blue-0.redpanda.redpanda.svc.cluster.local. 9093 1 active true 26.2.6 f72a7cb7-327d-47bb-80e2-6c7e7d921aed
1 redpanda-blue-1.redpanda.redpanda.svc.cluster.local. 9093 1 active true 26.2.6 5e5c4dbb-b2c0-4bd0-8a1f-161138dfa9f7
2 redpanda-blue-2.redpanda.redpanda.svc.cluster.local. 9093 1 active true 26.2.6 803b69e1-0013-4e28-8d61-bb1b6778aba4
DISK SPACE
==========
NODE-ID PATH FREE TOTAL USED%
0 /var/lib/redpanda/data 4.9GB 5.0GB 2.0%
1 /var/lib/redpanda/data 4.9GB 5.0GB 2.0%
2 /var/lib/redpanda/data 4.9GB 5.0GB 2.0%
All three brokers show active in the MEMBERSHIP column, true in the IS-ALIVE column, and the Redpanda version they run in the VERSION column (26.2.6 in this example).
Create the green broker pool
Create a new (green) broker pool with the target Redpanda version, v26.2.7 in this example:
brokerpool-green.yamlapiVersion: cluster.redpanda.com/v1alpha2
kind: RedpandaBrokerPool
metadata:
name: green
namespace: <namespace>
spec:
clusterRef:
name: redpanda
replicas: 3
image:
tag: v26.2.7 (1)
podTemplate:
spec:
nodeSelector:
nodetype: redpanda-green (2)
tolerations:
- key: redpanda-green (3)
operator: Equal
value: "true"
effect: NoSchedule
| 1 | The target Redpanda version. A tag on the broker pool overrides spec.clusterSpec.image.tag on the Redpanda CR for this broker pool only. Later changes to the Redpanda CR’s image tag don’t change the version these brokers run. |
| 2 | Optional. Keeps the green brokers on Kubernetes nodes labeled nodetype: redpanda-green. |
| 3 | Optional. Lets the green brokers run on nodes tainted with redpanda-green=true:NoSchedule. |
If you don’t need to pin the green brokers to specific Kubernetes nodes, leave out podTemplate. Kubernetes then schedules them on any available nodes.
Apply the broker pool:
kubectl apply -f brokerpool-green.yaml
Wait for all brokers to stabilize
For a while, the cluster runs twice the usual number of brokers (six in this example). Wait for the green Pods to become ready:
kubectl get pods -n <namespace> -l app.kubernetes.io/name=redpanda -o wide
Expected output (6 Pods)
NAME READY STATUS RESTARTS AGE IP NODE
redpanda-blue-0 2/2 Running 0 24h 10.244.1.5 worker-1
redpanda-blue-1 2/2 Running 0 24h 10.244.2.5 worker-2
redpanda-blue-2 2/2 Running 0 24h 10.244.3.5 worker-3
redpanda-green-0 2/2 Running 0 2m 10.244.4.5 worker-4
redpanda-green-1 2/2 Running 0 2m 10.244.5.5 worker-5
redpanda-green-2 2/2 Running 0 2m 10.244.6.5 worker-6
Wait for the cluster to report healthy with all six brokers:
kubectl exec -n <namespace> redpanda-blue-0 -c redpanda -- rpk cluster health
Expected output
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
Check that all six brokers are active, and that each pool runs the expected version:
kubectl exec -n <namespace> redpanda-blue-0 -c redpanda -- rpk cluster info -b --detailed
Expected output
BROKERS
=======
ID HOST PORT CORES MEMBERSHIP IS-ALIVE VERSION UUID
0* redpanda-blue-0.redpanda.redpanda.svc.cluster.local. 9093 1 active true 26.2.6 f72a7cb7-327d-47bb-80e2-6c7e7d921aed
1 redpanda-blue-1.redpanda.redpanda.svc.cluster.local. 9093 1 active true 26.2.6 5e5c4dbb-b2c0-4bd0-8a1f-161138dfa9f7
2 redpanda-blue-2.redpanda.redpanda.svc.cluster.local. 9093 1 active true 26.2.6 803b69e1-0013-4e28-8d61-bb1b6778aba4
3 redpanda-green-0.redpanda.redpanda.svc.cluster.local. 9093 1 active true 26.2.7 2c9e41a0-7d53-4f8e-9b1c-6a0f3e8d5b27
4 redpanda-green-1.redpanda.redpanda.svc.cluster.local. 9093 1 active true 26.2.7 9b7d0c34-1e6a-4c2f-a5d8-3f4e7b9c1a60
5 redpanda-green-2.redpanda.redpanda.svc.cluster.local. 9093 1 active true 26.2.7 47e1f9b2-8c3d-4a6e-b0f5-d2c8a7e9136b
DISK SPACE
==========
NODE-ID PATH FREE TOTAL USED%
0 /var/lib/redpanda/data 4.9GB 5.0GB 2.0%
1 /var/lib/redpanda/data 4.9GB 5.0GB 2.0%
2 /var/lib/redpanda/data 4.9GB 5.0GB 2.0%
3 /var/lib/redpanda/data 4.9GB 5.0GB 2.0%
4 /var/lib/redpanda/data 4.9GB 5.0GB 2.0%
5 /var/lib/redpanda/data 4.9GB 5.0GB 2.0%
Don’t continue until the cluster reports Healthy: true with zero leaderless and zero under-replicated partitions. All six brokers must show active in the MEMBERSHIP column and true in the IS-ALIVE column.
|
Delete the blue broker pool
Delete the old (blue) broker pool. The operator decommissions the blue brokers one at a time. It moves each broker’s partitions to the green brokers before it removes the broker.
kubectl delete redpandabrokerpool blue -n <namespace>
Monitor the decommission progress:
kubectl exec -n <namespace> redpanda-green-0 -c redpanda -- rpk cluster info -b --detailed
The blue brokers change from active to draining as the operator decommissions them:
Example output (decommission in progress)
BROKERS
=======
ID HOST PORT CORES MEMBERSHIP IS-ALIVE VERSION UUID
0* redpanda-blue-0.redpanda.redpanda.svc.cluster.local. 9093 1 draining true 26.2.6 f72a7cb7-327d-47bb-80e2-6c7e7d921aed
1 redpanda-blue-1.redpanda.redpanda.svc.cluster.local. 9093 1 active true 26.2.6 5e5c4dbb-b2c0-4bd0-8a1f-161138dfa9f7
2 redpanda-blue-2.redpanda.redpanda.svc.cluster.local. 9093 1 active true 26.2.6 803b69e1-0013-4e28-8d61-bb1b6778aba4
3 redpanda-green-0.redpanda.redpanda.svc.cluster.local. 9093 1 active true 26.2.7 2c9e41a0-7d53-4f8e-9b1c-6a0f3e8d5b27
4 redpanda-green-1.redpanda.redpanda.svc.cluster.local. 9093 1 active true 26.2.7 9b7d0c34-1e6a-4c2f-a5d8-3f4e7b9c1a60
5 redpanda-green-2.redpanda.redpanda.svc.cluster.local. 9093 1 active true 26.2.7 47e1f9b2-8c3d-4a6e-b0f5-d2c8a7e9136b
DISK SPACE
==========
NODE-ID PATH FREE TOTAL USED%
0 /var/lib/redpanda/data 4.9GB 5.0GB 2.0%
1 /var/lib/redpanda/data 4.9GB 5.0GB 2.0%
2 /var/lib/redpanda/data 4.9GB 5.0GB 2.0%
3 /var/lib/redpanda/data 4.9GB 5.0GB 2.0%
4 /var/lib/redpanda/data 4.9GB 5.0GB 2.0%
5 /var/lib/redpanda/data 4.9GB 5.0GB 2.0%
Wait for the cluster to stabilize with only green brokers:
kubectl wait --for=condition=Stable redpanda/redpanda -n <namespace> --timeout=600s
Verify the migration
Confirm that only the green brokers remain:
kubectl get pods -n <namespace> -l app.kubernetes.io/name=redpanda
Expected output
NAME READY STATUS RESTARTS AGE
redpanda-green-0 2/2 Running 0 10m
redpanda-green-1 2/2 Running 0 10m
redpanda-green-2 2/2 Running 0 10m
Verify cluster health:
kubectl exec -n <namespace> redpanda-green-0 -c redpanda -- rpk cluster health
Expected output
CLUSTER HEALTH OVERVIEW
=======================
Healthy: true
Unhealthy reasons: []
Controller ID: 3
All nodes: [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
Confirm that all brokers are running the target version:
kubectl exec -n <namespace> redpanda-green-0 -c redpanda -- rpk cluster info -b --detailed
Expected output
BROKERS
=======
ID HOST PORT CORES MEMBERSHIP IS-ALIVE VERSION UUID
3* redpanda-green-0.redpanda.redpanda.svc.cluster.local. 9093 1 active true 26.2.7 2c9e41a0-7d53-4f8e-9b1c-6a0f3e8d5b27
4 redpanda-green-1.redpanda.redpanda.svc.cluster.local. 9093 1 active true 26.2.7 9b7d0c34-1e6a-4c2f-a5d8-3f4e7b9c1a60
5 redpanda-green-2.redpanda.redpanda.svc.cluster.local. 9093 1 active true 26.2.7 47e1f9b2-8c3d-4a6e-b0f5-d2c8a7e9136b
DISK SPACE
==========
NODE-ID PATH FREE TOTAL USED%
3 /var/lib/redpanda/data 4.9GB 5.0GB 2.0%
4 /var/lib/redpanda/data 4.9GB 5.0GB 2.0%
5 /var/lib/redpanda/data 4.9GB 5.0GB 2.0%
Verify data integrity by checking your topics:
kubectl exec -n <namespace> redpanda-green-0 -c redpanda -- rpk topic list
Check that all topics are present and that their partitions are fully replicated:
kubectl exec -n <namespace> redpanda-green-0 -c redpanda -- rpk topic describe <topic-name>
You can also check that you can consume messages:
kubectl exec -n <namespace> redpanda-green-0 -c redpanda -- rpk topic consume <topic-name> -n 5
Set spec.clusterSpec.image.tag on the Redpanda CR to the target version, so that broker pools you create later without their own tag run the same version as the green brokers:
kubectl patch redpanda redpanda -n <namespace> --type merge \
-p '{"spec":{"clusterSpec":{"image":{"tag":"v26.2.7"}}}}'
The green broker pool sets its own tag, so this change doesn’t restart the green brokers. To have the green broker pool follow the Redpanda CR’s tag in future upgrades, remove its tag:
kubectl patch redpandabrokerpools.cluster.redpanda.com green -n <namespace> --type json \
-p '[{"op":"remove","path":"/spec/image/tag"}]'
Known limitations
-
Image changes restart existing brokers: Broker pool StatefulSets use the
OnDeleteupdate strategy, but the operator restarts the brokers itself when a broker pool’s image changes. That includes a change it takes fromspec.clusterSpec.imageon the Redpanda CR. To move to a new version on new brokers instead of restarting the existing ones, use a blue/green migration. -
Twice the brokers for a while: During the migration, the cluster runs twice the usual number of brokers. Make sure your environment has enough CPU, memory, and storage.