For the complete documentation index, see llms.txt. This page is also available as Markdown.

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

  1. Deploy K2K with the pipeline covering all topics needed for migration.

  2. Verify replication lag is stable — see Observability.

  3. Confirm schemas are available on the target Schema Registry if required.

Phase 2: Migrate applications one at a time

For each application:

  1. Pause the application on the source cluster (stop consumers and producers).

  2. Wait for lag to reach zero on the topics that application uses.

  3. Verify offset mapping for the application's consumer group:

  1. Reconfigure the application to use the target cluster bootstrap servers.

  2. Start the application on the target cluster and validate behavior.

  3. 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:

  1. Redirect producers to the target cluster.

  2. Allow K2K to replicate any remaining records from the source.

  3. Confirm no active consumers remain on the source cluster.

Phase 4: Decommission

  1. Stop K2K replicator and offset mapper.

  2. Remove the pipeline deployment (Helm uninstall or stop Docker containers).

  3. Decommission the source Kafka cluster after a retention period that satisfies your compliance requirements.

Consumer group validation

Before each application cutover, confirm:

Check
How

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

Issue
Action

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?