Quick revision
The short answer
There is no direct path from ZooKeeper mode to Kafka 4.x, so the programme is two migrations per cluster: first move each cluster to KRaft on a 3.x bridge release (normally the last 3.x line, 3.9), then upgrade to 4.x. The ZooKeeper-to-KRaft step can be rolled back only before it is finalised, so each cluster needs a rehearsed rollback and a go or no-go decision point. I would structure the work as an inventory of everything that touches ZooKeeper or uses old client protocols, a risk-ordered sequence starting with a non-critical cluster, and a plan that shows leadership the timeline, staffing, residual risk and the cost of staying on 3.x.
What to remember
In this answer, we saw that Kafka 4.0 removed ZooKeeper, so each cluster must first migrate to KRaft on a 3.x bridge release and only then upgrade to 4.x, with rollback possible only until finalisation. We built the programme around an inventory of ZooKeeper-dependent tooling and old clients, a risk-ordered sequence starting with a non-critical cluster, rehearsals and explicit go or no-go gates, and a leadership view that covers timeline, staffing, risks with owners, and the cost of staying on 3.x.
Your turn
Answer it aloud as you would in the interview, or type your answer below. Then show one part at a time and compare.
There is no direct path from ZooKeeper mode to Kafka 4.x, so the programme is two migrations per cluster: first move each cluster to KRaft on a 3.x bridge release (normally the last 3.x line, 3.9), then upgrade to 4.x. The ZooKeeper-to-KRaft step can be rolled back only before it is finalised, so each cluster needs a rehearsed rollback and a go or no-go decision point. I would structure the work as an inventory of everything that touches ZooKeeper or uses old client protocols, a risk-ordered sequence starting with a non-critical cluster, and a plan that shows leadership the timeline, staffing, residual risk and the cost of staying on 3.x.
Why this question is asked
Migrations like this fail less often on the technical steps than on everything around them: a forgotten script that writes ACLs straight into ZooKeeper, a ten-year-old client library in a batch job, or a rollback that nobody tried. A senior engineer is expected to turn the upgrade into a programme that leadership can fund and track, with risks named and owned. Interviewers ask this to see how we break down a platform change that touches 200 services. In this answer, we will recap why the move is forced, lay out the two-step technical path, build the inventory, order the clusters by risk, and frame the plan and its risks for leadership.
1Why the Move Is Not Optional
In older Kafka, ZooKeeper, a separate coordination service, stored the cluster's metadata: topics, partition leaders, configs and ACLs. KRaft replaced it with a quorum of Kafka controllers that keep the metadata in a Raft log. Kafka 4.0 removed ZooKeeper mode completely, so a 4.x broker cannot start against ZooKeeper at all.
Staying on 3.x is a decision with a cost. Community support for the 3.x line ends, so security fixes stop arriving, and every new feature, such as the new consumer group protocol from KIP-848 that removes the stop-the-world rebalance, is available only on 4.x. The leadership conversation starts here: not 'should we migrate' but 'when, in what order, and with what safety net'.
2The Two-Step Path for Each Cluster
Each cluster goes through the same sequence. First we upgrade it, still in ZooKeeper mode, to the bridge release. Then we run the ZooKeeper-to-KRaft migration on that release. Only after the migration is finalised do we upgrade the now-KRaft cluster to 4.x.
The migration itself has phases. We deploy new controller nodes with zookeeper.metadata.migration.enable=true, which makes them copy the existing metadata out of ZooKeeper into the KRaft log. We then restart the brokers with migration settings so they register with the new controllers, and then restart them again as KRaft brokers. During this period the controllers dual-write: every metadata change is written to the KRaft log and also mirrored into ZooKeeper. That dual-write is what makes rollback possible, because ZooKeeper still holds a current copy.
The last step is finalisation: we restart the controllers without the migration flag, and they stop writing to ZooKeeper. From that moment there is no going back to ZooKeeper. So the programme must place an explicit decision point before finalisation, after the cluster has run in migration mode under real load for long enough to trust it, and the rollback procedure must have been rehearsed on a staging copy, not just read.
- Upgrade brokers to the 3.x bridge releasestill in ZooKeeper mode
- Deploy KRaft controllers in migration modemetadata copied from ZooKeeper
- Roll brokers to KRaft with dual-writeZooKeeper kept current
- Soak under real load, run checksrollback still possible
- Go decision at the gate?YesFinalise: controllers stop writing ZooKeeperNoRoll back to ZooKeeper mode
- Upgrade KRaft cluster to 4.xnow a normal rolling upgrade
6 steps in order. Play them, or step through them one at a time.
The gate before finalisation is the last point where rollback is possible.
3Building the Inventory
The technical steps are documented; the surprises live in our own estate. So the first deliverable is an inventory, and it has three parts. The first is everything that talks to ZooKeeper directly: scripts that call kafka-topics.sh or kafka-configs.sh with --zookeeper, tools that manage ACLs or quotas through ZooKeeper, monitoring that reads ZooKeeper paths, and any in-house tooling that watches znodes. All of these must be moved to the Admin API and --bootstrap-server before the migration, because after it ZooKeeper stops being the truth.
The second part is clients. Kafka 4.0 dropped very old protocol versions (KIP-896), so clients older than roughly the 2.1 era can no longer connect. We list client software and versions per service, which broker request metrics and the client-software name and version that clients report make possible, and give the owners of outdated clients a deadline well before the 4.x upgrade. The third part is anything that depends on removed features or configs, such as old message format settings or deprecated broker options, found by diffing our configs against the 4.x upgrade notes.
4Ordering the Clusters by Risk
Six clusters should not migrate at once. We rank them by business impact and by how unusual they are. A non-critical cluster, say the one for internal logs, goes first and teaches us the real timings. Clusters with heavy custom tooling or very many partitions come later, once the playbook is proven. The cluster that carries payments goes last, after at least two clean migrations.
Every cluster gets the same treatment: a staging copy with the same version, configuration and roughly the same partition count, a full rehearsal including a rollback, written go and no-go criteria (no under-replicated partitions, consumer lag normal, admin operations working, no metadata errors), and a named person who makes the call at the gate. Reaching a no-go is not a failure of the programme; skipping the gate would be.
| Order | Cluster | Why here | Gate before finalise |
|---|---|---|---|
| 1 | internal logs | low impact, learn timings | 24 h soak, rollback rehearsed |
| 2 | analytics | many consumers, little custom tooling | 48 h soak, consumer lag normal |
| 3-5 | service clusters | playbook proven by now | 72 h soak, owners sign off |
| 6 | payments | highest impact, done last | 1 week soak, business sign-off |
5Presenting the Plan and Its Risks
Leadership does not need the controller flags. They need four things. The timeline: for example two to three weeks per cluster including soak time, with the first cluster acting as a pilot, so roughly two quarters for six clusters. The staffing: a small platform team running the migrations, plus time from service teams to replace ZooKeeper-dependent scripts and old clients. The risks, each with a mitigation and an owner: a migration bug (staging rehearsal and gate), an unknown dependency (inventory and a ZooKeeper access audit), a client that breaks on 4.x (version report and deadlines). And the residual risk we accept, such as a short window of elevated latency during broker restarts.
Finally we show the cost of staying: no security fixes after the 3.x line ends, no access to new features, and a migration that only becomes harder as the estate grows. Framed this way, the programme is a funded risk reduction with checkpoints, not an open-ended upgrade.
6Follow-up questions
Would you combine the migration with a move to a managed service?
Usually not in one step. A managed service is a separate migration of data, clients and operations, and combining the two doubles the unknowns in each change window. I would evaluate the managed option in parallel, and if it wins, migrate some clusters to it instead of to self-managed KRaft, with tools that copy data across, such as MirrorMaker 2 or a vendor's linking. That replaces the in-place migration for those clusters rather than stacking two risky changes.
How do you find hidden ZooKeeper users?
Enable and read the ZooKeeper audit or connection logs to see which hosts connect, search code and scripts for --zookeeper and ZooKeeper client libraries, and ask every team that owns automation. After the migration starts, any unexpected client connecting to ZooKeeper is a finding to chase before finalisation.
What if a cluster fails at the gate?
We roll it back to ZooKeeper mode using the rehearsed procedure, keep it on the bridge release, and run a review. The other clusters do not proceed until we understand the cause, because the same issue would likely repeat.
7Conclusion
In this answer, we saw that Kafka 4.0 removed ZooKeeper, so each cluster must first migrate to KRaft on a 3.x bridge release and only then upgrade to 4.x, with rollback possible only until finalisation. We built the programme around an inventory of ZooKeeper-dependent tooling and old clients, a risk-ordered sequence starting with a non-critical cluster, rehearsals and explicit go or no-go gates, and a leadership view that covers timeline, staffing, risks with owners, and the cost of staying on 3.x.
Open with
I would start by being clear that this is two migrations per cluster, not one. Kafka 4.0 has no ZooKeeper mode, and there is no direct upgrade, so each cluster first moves to KRaft on a 3.x bridge release, usually 3.9, and only after finalising that do we upgrade to 4.x.
Then, if they want more
The migration runs new controllers in migration mode that copy the metadata from ZooKeeper and dual-write changes back to it, which is what lets us roll back, but only until we finalise. So I would build a gate before finalisation with written go and no-go criteria, and rehearse the rollback on a staging copy of each cluster.
Before touching anything, I would inventory everything that talks to ZooKeeper directly, like scripts using --zookeeper, ACL and quota tooling and monitoring, and move them to the Admin API. I would also list client versions, because 4.x dropped very old protocol versions, and give owners deadlines.
Then I would order the six clusters by risk: a non-critical one first as a pilot, payments last.
For leadership I would present a timeline of a couple of quarters, the staffing from the platform team and service teams, each risk with a mitigation and an owner, and the cost of staying, meaning no security fixes after 3.x support ends and no new features like the KIP-848 consumer protocol.
About this answer
- Last updated
- 13 November 2026
- Versions it names
- Kafka 4.0
- Checked
- Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
- Where the question comes from
- Written by Scrivio for practice. It is not taken from an interview.
- Official documentation
- Apache Kafka documentation
Report an issue with this answer
Copy the line below and send it to the author with what you found. It carries the address of this page.
Issue with "Leadership asks for a plan and a risk assessment for moving to Kafka 4.x. How do you...": https://scrivio-interview-library.netlify.app/spring-boot/kafka-internals/4d40a87051/