Cluster migration
Gradual cluster migration procedure with K2K.
This runbook covers moving workloads from a source Kafka cluster to a target cluster while both remain in service. For the business context, see Use cases.
Prerequisites
Pipeline with both source and sink replication stages — see Topic selection and data routing
K2K replicator copying selected topics from old to new cluster
Offset mapping enabled with both applications running if applications switch one at a time without reprocessing
Schema migration enabled where applications depend on Schema Registry
Application inventory listing consumer groups to migrate
Validation checklist completed for the pipeline
Migration phases
Phase 1: Establish replication
Deploy K2K with the pipeline covering all topics needed for migration.
Verify replication lag is stable — see Observability.
Confirm schemas are available on the target Schema Registry if required.
Phase 2: Migrate applications one at a time
For each application:
Pause the application on the source cluster (stop consumers and producers).
Wait for lag to reach zero on the topics that application uses.
Verify offset mapping for the application's consumer group:
Reconfigure the application to use the target cluster bootstrap servers.
Start the application on the target cluster and validate behavior.
Resume the next application on the source cluster if others are still running.
Phase 3: Migrate producers
After all consumers are on the target cluster:
Redirect producers to the target cluster.
Allow K2K to replicate any remaining records from the source.
Confirm no active consumers remain on the source cluster.
Phase 4: Decommission
Stop K2K replicator and offset mapper.
Remove the pipeline deployment (Helm uninstall or stop Docker containers).
Decommission the source Kafka cluster after a retention period that satisfies your compliance requirements.
Consumer group validation
Before each application cutover, confirm:
Group is matched by groups.consumerGroups
Pipeline regex covers the group name
Target offset is current
k2k-tool describe shows committed ≈ last
Schemas exist on target
Consume a sample record with the target Schema Registry
Handling applications without offset mapping
If offset mapping is not enabled, applications deployed on the target cluster start with fresh consumer groups. This is acceptable when applications can tolerate reprocessing or when data is consumed only from the target going forward. See Deployment.
Bidirectional replication during migration
If both clusters must accept writes during migration, consider Bidirectional replication with one pipeline per direction. Plan loop prevention headers and topic routing carefully.
Troubleshooting during migration
Application reprocesses old records
Check offset mapping; verify group name matches regex
Schema incompatibility on target
Review Schema migration mappings
Lag never reaches zero
Scale replicator — see Horizontal scaling
See Troubleshooting for additional runtime diagnostics.
Last updated
Was this helpful?

