Skip to main content
Migration: ZooKeeper → KRaft

ZooKeeper to KRaft: pick your path, keep a way back

The migration procedure depends on where your Kafka runs — and every path has a point where rollback closes. Find your route, then take a verified backup before you touch cluster metadata.

Which ZooKeeper to KRaft path applies to you

A ZooKeeper to KRaft migration is not one procedure. Self-managed clusters migrate in place with the KIP-866 dual-write flow through the Kafka 3.9 bridge release. Strimzi runs that same flow from a single annotation. Amazon MSK has no in-place path at all — there, the migration becomes a cluster move.

The deadline is fixed upstream: ZooKeeper mode was deprecated in Kafka 3.5 and removed in 4.0. A 4.x broker will not start against ZooKeeper.

Your platformMigration pathRollback closes when
Self-managed Apache KafkaIn-place KIP-866 rolling migration via the 3.9 bridge releaseYou finalize — controllers restart without the migration flag
Strimzi on KubernetesSame flow, driven by strimzi.io/kraft="migration" (Strimzi 0.40+, Kafka 3.7+)You annotate enabled after KRaftPostMigration
Confluent PlatformIn-place migration on CP 7.6.1–7.9, required before CP 8.0Dual-write mode ends
Amazon MSKNo in-place path — new KRaft cluster plus a controlled moveSee the MSK migration page

Each in-place procedure is covered step by step in the complete ZooKeeper to KRaft migration guide. Still deciding whether to move at all? The KRaft vs ZooKeeper comparison settles that first.

Back up before you touch cluster metadata

Every path above rewrites the cluster's metadata layer while production traffic keeps flowing. The migration procedures protect metadata — they do nothing for the data in your topics if a step goes wrong mid-flight. A point-in-time backup with offset headers is the safety net that works on every platform, because it depends only on the Kafka protocol, not on ZooKeeper or KRaft.

Pre-migration backup — all topics, offsets preserved in headers
mode: backup
backup_id: "pre-kraft-migration"

source:
bootstrap_servers:
- broker-1.prod.kafka:9092
- broker-2.prod.kafka:9092
topics:
include:
- "*"
exclude:
- "__consumer_offsets"

storage:
backend: s3
bucket: my-kafka-backups
region: us-west-2
prefix: backups/pre-migration

backup:
compression: zstd
include_offset_headers: true # Required to reset consumer groups later
source_cluster_id: "prod-zk-cluster"

A backup taken on the ZooKeeper cluster restores to a KRaft cluster without changes — the storage format is independent of the metadata mode. That gives you a second migration route too: restore into a fresh KRaft cluster with consumer_group_strategy: header-based and consumers resume from equivalent positions. The migration use case shows that backup-and-restore pattern, and every key above is documented in the configuration reference.

After the switch

Keep the backup schedule running against the KRaft cluster from day one — the metadata mode changed, the durability question did not. If the migration also retires the old cluster, hold the pre-migration backup until your retention policy clears it: it is the only copy of the cluster's state from before the one-way door.

Frequently asked questions

How do I migrate Kafka from ZooKeeper to KRaft?

It depends on the platform. Self-managed Kafka migrates in place with the KIP-866 dual-write procedure through the 3.9 bridge release. Strimzi drives the same flow with the strimzi.io/kraft annotation. Confluent Platform migrates in place on 7.6.1–7.9. Amazon MSK requires a new KRaft cluster and a data move.

Is a ZooKeeper to KRaft migration reversible?

Only until finalization. In the KIP-866 flow you can revert at every stage until controllers restart without the migration flag; on Strimzi, until you annotate kraft=enabled. After that, reverting to ZooKeeper mode is no longer possible — which is why a pre-migration backup matters.

Do I need to migrate to KRaft before upgrading to Kafka 4.0?

Yes. ZooKeeper support was removed in Kafka 4.0, so every ZooKeeper-mode cluster must complete a KRaft migration before the 4.x upgrade. Kafka 3.9 is the bridge release to migrate through.

Does a Kafka backup taken in ZooKeeper mode restore to a KRaft cluster?

Yes. Backups depend on the Kafka protocol, not the metadata layer, so a backup from a ZooKeeper-mode cluster restores to a KRaft-mode cluster unchanged. With offset headers included, consumer groups can be repositioned on the new cluster as well.

What happens to consumer offsets during a KRaft migration?

In-place migrations preserve committed offsets because the __consumer_offsets topic never leaves the cluster. Cluster-move migrations (like MSK) must translate offsets explicitly — restore with header-based consumer group strategy, or use a migration pipeline that commits translated offsets on the target.

Ready to protect your Kafka data?

Take your first backup in minutes with the open source CLI, or talk to us about Enterprise features like encryption, RBAC, and audit logging.