Kafka is one of the topics teams ask me about most when they request training. Behind almost every request for a cluster that was set up with ZooKeeper, there is now the same question: what happens when we move to 4.x?
Kafka 4.0 removed ZooKeeper completely. Cluster metadata lives in KRaft, Kafka’s own controller quorum, and a 4.x broker cannot run against ZooKeeper at all.
Why a version bump is the most expensive mistake
That is why I think the most expensive mistake is to treat this as a version bump: change the version in the Helm chart, roll the brokers, done. There is no direct jump from a ZooKeeper-based 3.x cluster to 4.x. The migration has a point of no return, and most teams only find out where it is when they need to go back.
| Phase | Rollback to ZooKeeper possible? | ZooKeeper still needed? | Upgrade to 4.x allowed? |
|---|---|---|---|
| Migration mode (before finalizing) | Yes – how depends on the step you reached | Yes | No |
| After finalizing | No | No – decommission it | Yes |
The KRaft migration order I teach
So this is the order I teach and recommend:
- Inventory everything that still talks to ZooKeeper: scripts with
--zookeeperflags, monitoring checks, ACL tooling, old clients. Check the 4.0 floor at the same time: brokers need Java 17 (clients and Streams Java 11), and every client, including Streams and Connect, must be on 2.1 or higher before the brokers move to 4.0. - Upgrade the brokers to 3.9.1 with
inter.broker.protocol.version=3.9– the starting point for the migration – while you are still on ZooKeeper. - Start a KRaft controller quorum in migration mode and let it copy the metadata. The controllers use the same cluster ID as the existing cluster, their
node.idmust not collide with anybroker.id, and the metadata version stays untouched for the whole migration. - Move the brokers over one by one and watch them under real load.
- Rehearse the rollback before you finalize. Until ZooKeeper is removed for good you can go back; after finalizing you cannot.
- Finalize, decommission ZooKeeper, and only then upgrade to 4.x.
The order is boring. Skipping a step is what turns a planned weekend into an incident.
FAQ: moving Kafka from ZooKeeper to KRaft
Can I upgrade from Kafka 3.x with ZooKeeper directly to 4.0?
No. Kafka 4.0 has no ZooKeeper mode. Migrate to KRaft on 3.x first, starting from 3.9.1, and upgrade to 4.0 only after the migration is finalized.
Can I roll back a KRaft migration?
Yes, while the cluster is still in migration mode; how you revert depends on the step you reached. Once the migration is finalized and ZooKeeper is removed, there is no way back.
Which Java version does Kafka 4.0 need?
Brokers, Connect and the tools need Java 17. Clients and Kafka Streams need Java 11. Clients older than version 2.1 are no longer supported, so upgrade them before the brokers.
Should we migrate in place or build a new KRaft cluster?
In place keeps topics, offsets and client connections where they are, but every step happens on the production cluster. A new KRaft cluster makes falling back simple, because the old cluster keeps running, but you have to mirror the data and switch every client over.