For a decade, every Kafka cluster needed an Apache ZooKeeper ensemble next to it. As of Kafka 3.3 the KRaft (Kafka Raft) controller is production-ready, and from Kafka 4.0 ZooKeeper mode is removed. This article is the decision framework we use with clients: what KRaft actually changes, why every new deployment should be KRaft, what the migration path looks like for existing ZK-mode clusters, and the gotchas that show up when you skip the planning step.
How to verify
Check what mode a running cluster is in:
# ZK mode shows zookeeper.connect; KRaft does not
grep -E '^(zookeeper.connect|process.roles|controller.quorum.voters)' \
/etc/kafka/server.properties
# KRaft clusters expose metadata via the admin API
/opt/kafka/bin/kafka-metadata-quorum.sh --bootstrap-server localhost:9092 describe --status
# ZK clusters answer this; KRaft does not
echo srvr | nc zookeeper-01 2181 2>/dev/null | head -5
If process.roles is set in the broker config and kafka-metadata-quorum.sh returns a leader/voter list, the cluster is KRaft. If zookeeper.connect is set and the ZK 4-letter words answer, it is ZK mode.
What’s happening
ZooKeeper mode keeps cluster metadata (broker membership, topic configs, partition leader assignments, ACLs, dynamic configs) in a ZooKeeper ensemble. One Kafka broker is elected the “controller” via ZooKeeper; it computes leader-election decisions and pushes them to the rest of the cluster via the broker-to-broker protocol. Two systems, two distributed consensus stacks (ZooKeeper’s ZAB and Kafka’s own), two operational practices, two security models, and a multi-decade history of edge cases (split-brain during ZK GC pauses, controller-election storms, etc.).
KRaft mode moves the metadata into a dedicated Kafka topic (__cluster_metadata) managed by a Raft-based controller quorum running inside the Kafka process itself. The controller quorum is a separate set of nodes (or co-located in dev) that elects a leader, replicates the metadata log with Raft, and serves it to brokers. No ZooKeeper, no second daemon, no second packaging story, no second port to firewall.
The benefits are not just operational simplicity:
- Faster controller failover — KRaft elects a new leader from an in-memory quorum in single-digit seconds; ZK-mode controller elections can take tens of seconds with a large cluster because the new controller has to load metadata from ZK.
- Higher partition limits — KRaft handles millions of partitions per cluster; ZK mode practically caps around 200,000 because of metadata-load times during failover.
- Single security model — auth, ACLs, encryption are all configured on the Kafka side; no separate ZK SASL or DigestAuth dance.
- Smaller blast radius — one set of processes to monitor, one log to read for cluster-state issues.
The cost is that you must plan the role split: KRaft has two roles — controller and broker — that can be combined in dev but should be separated in production. Controllers do not handle client traffic; they hold metadata. Brokers handle client traffic. Three or five controller nodes form the quorum; brokers can be added or removed without touching the controller quorum.
The decision
New deployment — always KRaft. ZooKeeper mode is removed in Kafka 4.0; deploying ZK mode in 2026 means scheduling a migration before you have even finished onboarding the application teams. Pick KRaft from day one, with a 3-node controller quorum and as many brokers as your partition count requires.
Existing ZK-mode cluster — plan the migration. The supported path is:
- Upgrade the cluster to a bridge release (Kafka 3.4 or later) that supports both modes.
- Stand up the KRaft controller quorum alongside the existing ZK ensemble.
- Run the migration tooling (
kafka-storage.shwith--standaloneand migration flags) which copies the ZK metadata into the KRaft__cluster_metadatatopic and dual-writes until you cut over. - Roll the brokers to KRaft mode one at a time.
- Remove the ZooKeeper ensemble once every broker is KRaft and the migration tool reports completion.
The migration is non-trivial — it is a multi-hour change-window for a busy cluster, with rollback contingencies and lots of monitoring. Do not start it on a Friday afternoon.
Existing cluster too old to bridge (Kafka 2.x or early 3.x) — plan a two-step upgrade: first bring the cluster to a bridge release (still on ZK), then migrate to KRaft. Skipping releases on the upgrade path is unsupported and unfortunate to debug.
Operational notes
- The KRaft controller log lives in
metadata.log.dir(defaults to the first entry oflog.dirs); back it up like any other state — losing it is losing the cluster. - A 3-node controller quorum tolerates 1 node loss; a 5-node quorum tolerates 2. Three is the sane production minimum; five is for very large or geographically distributed clusters.
- Co-locating the controller role on broker nodes (“combined mode”) is supported in production but not recommended — controller leader elections are sensitive to broker load. Separate processes on separate hosts (or at least separate VMs) is the production stance.
- KRaft does not change the on-disk format of topic partitions; producer and consumer APIs are unchanged. Application teams should not notice the migration. If they do, something is wrong with the migration plan.
- Tooling that talks to ZooKeeper directly (some old monitoring agents, some custom scripts) needs replacing — the Kafka Admin API is the supported path in KRaft mode.
Stack Harbor stands up KRaft clusters as the default for clients greenfielding their event tier — three-node controller quorums, broker counts sized to partition load, and the upgrade and migration playbooks already written before the first production traffic hits. For clients on existing ZK-mode deployments, we plan and execute the migration as a bounded change-window engagement. This is the work covered by our Managed Operations practice.