Kafka 4.x ships without any ZooKeeper code, so a ZooKeeper cluster cannot roll straight onto it. The upgrade notes say it plainly: broker upgrades to 4.x “require KRaft mode”. That means a Kafka ZooKeeper to KRaft migration on the 3.9 bridge release first, then a normal rolling upgrade. Skip the bridge and the new brokers will not even start against your old metadata.
We ran the whole path on a live three broker cluster with a producer writing 100 records a second and the orders-app consumer group reading the entire time. You’ll see the phases as the controller logs them, where the rollback window closes, what a pre-2.1 client gets back from a 4.x broker, and one feature upgrade that quietly changed min.insync.replicas. Every command below ran on six Ubuntu 24.04 VMs in November 2026, taking Kafka 3.8.1 through the 3.9.2 bridge to 4.4.0.
Plan the path from ZooKeeper to Kafka 4.x
The lab mirrors a common small production layout: three brokers that also host the three node ZooKeeper ensemble, plus three new VMs for the KRaft controllers. The migration docs only describe dedicated controllers, and they call combined broker and controller nodes a development setup, so new controller VMs are the safe choice. Hostnames are broker1 to broker3 and controller1 to controller3, resolvable from every node.

Brokers keep their IDs 1, 2 and 3 for life. The controllers get node IDs 3001 to 3003, and that gap matters: in KRaft the brokers and controllers share one node ID namespace, so a controller can never reuse an existing broker.id. Here is every phase we went through, with the time each one took on the lab cluster.
| Phase | What changes | Measured time | Rollback |
|---|---|---|---|
| 1. Roll brokers to the 3.9.x bridge | Binaries, then inter.broker.protocol.version=3.9 | 12 to 19 s per broker, two rolls | Normal downgrade |
| 2. Provision KRaft controllers | Three new nodes formatted with the ZooKeeper cluster ID | About 3 s to elect a leader | Delete the controllers |
| 3. Brokers into migration mode | Metadata copied from ZooKeeper, dual writes start | 56 s from first broker restart to DUAL_WRITE | Yes, with the epoch fix |
| 4. Brokers to KRaft mode | process.roles=broker, no more ZooKeeper on brokers | 17 to 19 s per broker | Yes, two rolls back |
| 5. Finalize | Controllers drop the ZooKeeper settings | 7 s per controller | No |
| 6. Roll to Kafka 4.x | Binaries, then kafka-features.sh upgrade | 12 to 21 s per node | Binaries only, until the features bump |
The whole run took about 23 minutes of wall clock, and most of that was us reading output between steps. The producer never logged a failed send. If you’re still on a single node or a Compose lab, the multi-broker Kafka setup with Docker Compose is a cheaper place to rehearse this before you touch real brokers.
Starting state: a live 3.8 ZooKeeper cluster
Before touching anything, the brokers ran Kafka 3.8.1 in ZooKeeper mode. The broker log confirms the version:
sudo grep -m1 "Kafka version" /var/log/kafka/server.log
The first start recorded in broker1’s log:
[2026-11-30 17:25:26,565] INFO Kafka version: 3.8.1 (org.apache.kafka.common.utils.AppInfoParser)
Two topics carried the traffic: orders with 6 partitions and payments with 3, both at replication factor 3. Describe the busier one:
/opt/kafka/bin/kafka-topics.sh --bootstrap-server broker1:9092 --describe --topic orders
Every partition had all three replicas in sync, and the topic inherited min.insync.replicas=2 from the brokers. Keep that value in mind, because the 4.x feature upgrade changes it later. The 3.8 tools also print a harmless WARN that DescribeTopicPartitions is not supported against ZooKeeper-mode brokers, which is left out here:
Topic: orders TopicId: _aAsruunQhWU_uVKD0Ddiw PartitionCount: 6 ReplicationFactor: 3 Configs: min.insync.replicas=2
Topic: orders Partition: 0 Leader: 2 Replicas: 2,1,3 Isr: 2,1,3 Elr: N/A LastKnownElr: N/A
Topic: orders Partition: 1 Leader: 3 Replicas: 3,2,1 Isr: 3,2,1 Elr: N/A LastKnownElr: N/A
Topic: orders Partition: 2 Leader: 1 Replicas: 1,3,2 Isr: 1,3,2 Elr: N/A LastKnownElr: N/A
Topic: orders Partition: 3 Leader: 2 Replicas: 2,3,1 Isr: 2,3,1 Elr: N/A LastKnownElr: N/A
Topic: orders Partition: 4 Leader: 3 Replicas: 3,1,2 Isr: 3,1,2 Elr: N/A LastKnownElr: N/A
Topic: orders Partition: 5 Leader: 1 Replicas: 1,2,3 Isr: 1,2,3 Elr: N/A LastKnownElr: N/A
A kafka-producer-perf-test.sh run wrote 100 records a second into orders, and a console consumer in the orders-app group read it the whole time. Check the group the same way you will after each phase:
/opt/kafka/bin/kafka-consumer-groups.sh --bootstrap-server broker1:9092 --describe --group orders-app
One consumer owned all six partitions, with lag between 0 and 103 records while the producer ran:
GROUP TOPIC PARTITION CURRENT-OFFSET LOG-END-OFFSET LAG CONSUMER-ID HOST CLIENT-ID
orders-app orders 0 2531 2531 0 console-consumer-9fdd2ebf-e408-4871-815a-3aa5c220b3be /10.128.15.225 console-consumer
orders-app orders 1 2053 2053 0 console-consumer-9fdd2ebf-e408-4871-815a-3aa5c220b3be /10.128.15.225 console-consumer
orders-app orders 2 1730 1833 103 console-consumer-9fdd2ebf-e408-4871-815a-3aa5c220b3be /10.128.15.225 console-consumer
orders-app orders 3 2353 2353 0 console-consumer-9fdd2ebf-e408-4871-815a-3aa5c220b3be /10.128.15.225 console-consumer
orders-app orders 4 1982 2044 62 console-consumer-9fdd2ebf-e408-4871-815a-3aa5c220b3be /10.128.15.225 console-consumer
orders-app orders 5 1955 1985 30 console-consumer-9fdd2ebf-e408-4871-815a-3aa5c220b3be /10.128.15.225 console-consumer
Note the consumer ID. The same member is still attached after the 4.x roll at the end, which is the simplest proof that consumers ride through the migration without a rebalance storm.
Check the preconditions first
A few cluster shapes can’t migrate at all, and finding out halfway is expensive. The 3.9 KRaft operations page lists what isn’t supported during the migration, and two items catch real clusters. Check these on every broker before you plan a window:
- One entry in
log.dirsper broker (no JBOD) - Java 17 on every broker and controller
- Free node IDs for the controllers, outside the
broker.idrange - No ZooKeeper security migration tool run in the past, or a plan to clear
/migration
The JBOD check is one grep. A comma in the value means several data directories. The docs list JBOD as not fully implemented in KRaft and warn that any directory failure during the migration shuts the broker down, so consolidate disks before going further.
grep -E "^(broker.id|log.dirs)" /etc/kafka/server.properties
On the lab brokers each node had a single data directory, so the cluster qualified:
broker.id=1
log.dirs=/var/lib/kafka/data
Java is the other early stop. Kafka 4.x brokers and tools need Java 17 while clients need Java 11, so install OpenJDK 17 now. Our Kafka on Ubuntu guide covers the package and the kafka service user if you’re building fresh controller nodes.
Find clients that Kafka 4.x will reject
Kafka 4.0 removed old protocol versions under KIP-896, including Produce v0 to v2 and Fetch v0 to v3. The upgrade notes ask for Java clients at 2.1 or newer. Brokers since 3.7 count every request that uses a version scheduled for removal, so you can find the offenders from JMX long before the 4.x roll.
/opt/kafka/bin/kafka-run-class.sh org.apache.kafka.tools.JmxTool \
--jmx-url service:jmx:rmi:///jndi/rmi://localhost:9999/jmxrmi \
--object-name 'kafka.network:type=RequestMetrics,name=DeprecatedRequestsPerSec,*' \
--attributes Count --one-time true --report-format properties
The brokers in this lab start with JMX_PORT=9999 in the systemd unit, which is what the URL points at. We pointed a Kafka 0.10.2.2 console producer at the cluster while it still ran the bridge release, and broker1 caught it on the first message:
time=1796060397670
kafka.network:type=RequestMetrics,name=DeprecatedRequestsPerSec,request=Produce,version=2,clientSoftwareName=unknown,clientSoftwareVersion=unknown:Count=1
Run this on the 3.9.x brokers, not on 3.8. On the 3.8 cluster the same check also flagged a Kafka 2.0.1 producer at Produce v6, which 4.x still accepts. On 3.9.x only the 0.10 client showed up, which matches what happened after the upgrade. Clients that don’t send a software name show as unknown, so match them by source IP in the request log instead.
Roll the brokers to the 3.9 bridge release
Migration requires every broker on 3.9.1 or later with inter.broker.protocol.version=3.9. Use 3.9.2, the last bridge release, which also adds an opt-in fix for the AlterConfigPolicy inconsistency tracked as KIP-1252 (alter.config.policy.kraft.compatibility.enable, off by default). The 3.9 line is archived now and exists only to get you off ZooKeeper, so download it from the Apache archive.
KAFKA_BRIDGE=3.9.2 # pin: last 3.9.x bridge release for the migration #https://kafka.apache.org/community/downloads/
curl -fLO https://archive.apache.org/dist/kafka/${KAFKA_BRIDGE}/kafka_2.13-${KAFKA_BRIDGE}.tgz
sudo tar xzf kafka_2.13-${KAFKA_BRIDGE}.tgz -C /opt
Do this on all three brokers and the three controllers. Before the first restart, pin the protocol to the version you’re leaving, so 3.9 brokers keep talking 3.8 to the ones not yet rolled. Add this line to /etc/kafka/server.properties on every broker:
inter.broker.protocol.version=3.8
Now roll one broker at a time. The lab keeps each release in its own directory under /opt with a /opt/kafka symlink, so a roll is a stop, a link swap and a start:
sudo systemctl stop kafka
sudo ln -sfn /opt/kafka_2.13-3.9.2 /opt/kafka
sudo systemctl start kafka
Do not touch the next broker until under-replicated partitions drop to zero. This command prints nothing when the cluster has caught up, and we polled it every three seconds between restarts:
/opt/kafka/bin/kafka-topics.sh --bootstrap-server localhost:9092 --describe --under-replicated-partitions
The binary roll took 13, 12 and 19 seconds per broker. Then change the pin to inter.broker.protocol.version=3.9 and roll all three again, which took 14, 19 and 19 seconds. Confirm the version and protocol each broker actually loaded:
sudo grep "Kafka version" /var/log/kafka/server.log | tail -1
sudo grep "inter.broker.protocol.version = " /var/log/kafka/server.log | tail -1
Both lines must show the bridge release before you go on:
[2026-11-30 17:30:20,800] INFO Kafka version: 3.9.2 (org.apache.kafka.common.utils.AppInfoParser)
inter.broker.protocol.version = 3.9
Leave the protocol at 3.9 from here on. The 3.9 docs say changing the metadata version during a migration can break the cluster, so this value stays frozen until the migration is finalized and the 4.x upgrade takes over.
Format the controllers with the cluster ID
The controllers must join the existing cluster, not start a new one, so they get formatted with the cluster ID that ZooKeeper already holds. You can read it from any broker with the bundled shell:
/opt/kafka/bin/zookeeper-shell.sh broker1:2181 get /cluster/id 2>/dev/null | tail -1
The id field is the value you need, and it matches cluster.id in each broker’s meta.properties:
{"version":"1","id":"IF2csMNTRxGzXlYYtz0ePw"}
Next, write the controller config on each controller node. Change node.id and the listeners hostname per node and keep everything else identical:
sudo vim /etc/kafka/controller.properties
Here is controller1’s config for the migration. The zookeeper.metadata.migration.enable and zookeeper.connect lines are what make it a migration controller, and inter.broker.listener.name tells it which broker listener to use when it sends requests to the ZooKeeper-mode brokers:
process.roles=controller
node.id=3001
controller.quorum.voters=3001@controller1:9093,3002@controller2:9093,3003@controller3:9093
controller.listener.names=CONTROLLER
listeners=CONTROLLER://controller1:9093
listener.security.protocol.map=CONTROLLER:PLAINTEXT,PLAINTEXT:PLAINTEXT
log.dirs=/var/lib/kafka/metadata
# ZooKeeper migration
zookeeper.metadata.migration.enable=true
zookeeper.connect=broker1:2181,broker2:2181,broker3:2181
inter.broker.listener.name=PLAINTEXT
The docs also recommend TRACE logging for the migration code while it runs, and we added log4j.logger.org.apache.kafka.metadata.migration=TRACE to each controller’s log4j.properties. Next, format the metadata directory as the kafka user. Run the chown first: formatting as root and fixing ownership afterwards left us with an AccessDeniedException on the first attempt.
sudo chown -R kafka:kafka /var/lib/kafka /var/log/kafka
sudo -u kafka /opt/kafka/bin/kafka-storage.sh format -t IF2csMNTRxGzXlYYtz0ePw -c /etc/kafka/controller.properties
Each controller reports the metadata version it was bootstrapped with:
Formatting metadata directory /var/lib/kafka/metadata with metadata.version 3.9-IV0.
Start the controllers with their own unit (ours is kafka-controller.service, a copy of the broker unit pointed at controller.properties with a 512 MB heap). The quorum elected 3001 as leader about three seconds after the last one came up, and the log confirms migration mode:

Two things here are normal. The voters show directoryId: null because this is a static quorum, and the controller repeats “No brokers are known to KRaft, waiting for brokers to register” until you finish the next step. The JMX gauge kafka.controller:type=KafkaController,name=ZkMigrationState reads 2 at this point, which is PRE_MIGRATION.
Put the brokers into migration mode
Now each broker learns about the controller quorum while it keeps its ZooKeeper connection, so you can still back out cleanly if anything looks wrong. Append these lines to server.properties on every broker, leaving broker.id, zookeeper.connect and the protocol pin untouched:
# ZooKeeper to KRaft migration
zookeeper.metadata.migration.enable=true
controller.quorum.voters=3001@controller1:9093,3002@controller2:9093,3003@controller3:9093
controller.listener.names=CONTROLLER
listener.security.protocol.map=PLAINTEXT:PLAINTEXT,CONTROLLER:PLAINTEXT
Roll the brokers the same way you did for the bridge release. Ours took 17, 16 and 21 seconds. Nothing happens until the last broker registers, because the controller waits for every broker before it copies a single record. Then the whole metadata copy finished in under a second:

Read the timestamps. The driver sat in WAIT_FOR_BROKERS from 17:32:32 to 17:34:10, then moved through ZK_MIGRATION, SYNC_KRAFT_TO_ZK and into DUAL_WRITE inside 0.7 seconds. The full completion line counted 66 records generated in 386 ms, made up of 3 topics, 59 partitions, 3 configs and 1 producer ID block. A large cluster will take longer here, but it’s still a one-time copy.
From this point the KRaft quorum is the controller and ZooKeeper becomes a mirror. ZkMigrationState reads 1 (MIGRATION) and ZkWriteBehindLag should stay at 0. That lag is the metric to alert on while you sit in dual-write mode, because a growing value means ZooKeeper is falling behind and a rollback would lose changes. Our Prometheus and Grafana setup for Kafka scrapes both gauges through the JMX exporter.
Record the rollback data before you go further
Until you finalize, you can return to ZooKeeper mode. The trap is the controller epoch. During the migration KRaft writes its own epoch into the partition state znodes, and if that epoch ends up higher than the ZooKeeper controller epoch, a reverted ZooKeeper controller assumes another controller outranks it and refuses partition state changes. Read all three values now to learn what they look like on a healthy cluster, and read them again at revert time, after the quorum is gone, because kraft_controller_epoch rises with every KRaft leader change:
/opt/kafka/bin/zookeeper-shell.sh broker1:2181 get /controller_epoch 2>/dev/null | tail -1
/opt/kafka/bin/zookeeper-shell.sh broker1:2181 get /migration 2>/dev/null | tail -1
/opt/kafka/bin/zookeeper-shell.sh broker1:2181 get /controller 2>/dev/null | tail -1
In the lab the ZooKeeper epoch was 9 and the KRaft epoch in /migration was 1, so no fix was needed. The /controller znode now names 3001, a KRaft controller, which is how ZooKeeper-mode brokers know not to elect one of their own.

If kraft_controller_epoch is ever the higher number, the 3.9 docs say to run set /controller_epoch with a value above it as part of the revert. This is not a theoretical edge. KAFKA-20488, filed against 3.9.2 at Blocker priority, describes a reverted cluster whose ZooKeeper controller hits partition state znodes stamped with the higher KRaft epoch, logs “Aborted leader election for partition” and leaves those partitions offline. Jira marks it fixed in 3.9.3, but 3.9.3 was not on the Kafka downloads page as of November 30, 2026, so on 3.9.2 the manual epoch check is mandatory, and that error string is the first thing to grep the broker logs for after a revert. The full revert depends on how far you got, and the docs table boils down to this:
- Brokers already in KRaft mode: put
broker.idandzookeeper.connectback, dropprocess.roles, keep the migration flag on, and roll - Stop and remove the KRaft controllers
- Fix the epoch if needed, then
delete /controllerstraight away - Save the output of
get /migration, thendelete /migration - Remove the migration and controller settings from the brokers and roll again
Move fast between stopping the controllers and deleting /controller, because the cluster has no controller at all in that gap. Broker log errors about the unreachable KRaft controllers are expected until the second roll.
Move the brokers to KRaft mode
The brokers still use ZooKeeper for their own registration. To cut that, replace server.properties on each broker with a pure KRaft broker config. The broker keeps its ID, now spelled node.id, and loses zookeeper.connect, the migration flag and the protocol pin:
process.roles=broker
node.id=1
listeners=PLAINTEXT://:9092
advertised.listeners=PLAINTEXT://broker1:9092
listener.security.protocol.map=PLAINTEXT:PLAINTEXT,CONTROLLER:PLAINTEXT
controller.quorum.voters=3001@controller1:9093,3002@controller2:9093,3003@controller3:9093
controller.listener.names=CONTROLLER
log.dirs=/var/lib/kafka/data
num.partitions=6
default.replication.factor=3
min.insync.replicas=2
offsets.topic.replication.factor=3
transaction.state.log.replication.factor=3
transaction.state.log.min.isr=2
Roll them one at a time again (19, 17 and 18 seconds here). When the last one is back, the quorum should list all three brokers as observers:
/opt/kafka/bin/kafka-metadata-quorum.sh --bootstrap-server broker1:9092 describe --status
The observers each have a directory ID now, which is how KRaft tracks a broker’s log directory:
ClusterId: IF2csMNTRxGzXlYYtz0ePw
LeaderId: 3001
LeaderEpoch: 1
HighWatermark: 1139
MaxFollowerLag: 0
MaxFollowerLagTimeMs: 0
CurrentVoters: [{"id": 3001, "directoryId": null, "endpoints": ["CONTROLLER://controller1:9093"]}, {"id": 3002, "directoryId": null, "endpoints": ["CONTROLLER://controller2:9093"]}, {"id": 3003, "directoryId": null, "endpoints": ["CONTROLLER://controller3:9093"]}]
CurrentObservers: [{"id": 1, "directoryId": "M31Joq_YWthFPhfJqpa83g"}, {"id": 3, "directoryId": "F5D7bJqAKmsEmlBdKT2qLg"}, {"id": 2, "directoryId": "eHHd3qkvqYAT5cGKhegi9A"}]
ZooKeeper’s /brokers/ids is now an empty list, yet dual writes are still running. To prove it, we created a topic through the KRaft brokers and looked for it in ZooKeeper:
/opt/kafka/bin/kafka-topics.sh --bootstrap-server broker1:9092 --create --topic invoices --partitions 3 --replication-factor 3
/opt/kafka/bin/zookeeper-shell.sh broker1:2181 ls /brokers/topics
The new topic appeared in ZooKeeper two seconds later, and ZkWriteBehindLag stayed at 0:
Created topic invoices.
[__consumer_offsets, invoices, orders, payments]
This is the state you soak in. The docs mention operators who wait a week or two here before finalizing, and that’s sensible for anything with real traffic, since every change still lands in ZooKeeper and the revert path stays open.
Finalize the migration
Finalizing is the point of no return. Once the controllers restart without the ZooKeeper settings they stop writing to ZooKeeper, and the revert table has no entry for this stage. On each controller, delete these three lines from controller.properties:
zookeeper.metadata.migration.enable=true
zookeeper.connect=broker1:2181,broker2:2181,broker3:2181
inter.broker.listener.name=PLAINTEXT
Restart the controllers one at a time, as you did the brokers, with sudo systemctl restart kafka-controller. Each took 7 seconds. The first restart of a controller in this state writes the POST_MIGRATION record, and the replication view shows a clean quorum:

The POST_MIGRATION line at the bottom of that capture comes from controller3’s controller.log (QuorumController id=3003), not from broker1, so grep the controller hosts when you look for it. All six nodes sit at the same log end offset with zero lag, and ZkMigrationState reads 3 on every controller. The ZooKeeper ensemble can go once you’ve confirmed nothing else uses it. We stopped it on all brokers with sudo systemctl disable --now zookeeper, and topic listing kept working with the producer still at 100 records per second.
Upgrade the cluster to Kafka 4.x
With ZooKeeper gone this is a standard KRaft rolling upgrade. You need the release on all six nodes. The current release sits on the Apache CDN, which was far quicker than the main download mirror in our run:
KAFKA_TARGET=4.4.0 # pin: release tested in this guide #https://kafka.apache.org/community/downloads/
curl -fLO https://dlcdn.apache.org/kafka/${KAFKA_TARGET}/kafka_2.13-${KAFKA_TARGET}.tgz
sudo tar xzf kafka_2.13-${KAFKA_TARGET}.tgz -C /opt
Roll the controllers first, then the brokers, swapping the /opt/kafka link to /opt/kafka_2.13-4.4.0 on each one. Controllers took 12, 12 and 13 seconds, brokers 21, 18 and 20. One caveat from the 4.4 notes: a storage directory formatted by a newer kafka-storage cannot be read by an older broker, so don’t format replacement nodes with the 4.x tool while any node still runs 3.9.
The new binaries run at the old metadata version until you finalize the features. Preview the change with a dry run first:
/opt/kafka/bin/kafka-features.sh --bootstrap-server broker1:9092 upgrade --release-version 4.4 --dry-run
One flag moves seven features, and two of them change behavior, not just the on-disk format:
eligible.leader.replicas.version can be upgraded to 1.
group.version can be upgraded to 1.
kraft.version can be upgraded to 1.
metadata.version can be upgraded to 33.
share.version can be upgraded to 2.
streams.version can be upgraded to 1.
transaction.version can be upgraded to 2.
Before you run it for real, set the cluster default for min.insync.replicas to the value your brokers use. The next section shows why. The ELR docs say the controller only adds its own cluster-level value when none exists, so a default you set now survives the bump without restarting anything. We skipped this step in the lab, and that is how we ran into the reset described next:
/opt/kafka/bin/kafka-configs.sh --bootstrap-server broker1:9092 --alter --entity-type brokers --entity-default --add-config min.insync.replicas=2
Then apply the upgrade:
/opt/kafka/bin/kafka-features.sh --bootstrap-server broker1:9092 upgrade --release-version 4.4
The describe output afterwards shows the finalized levels:

After this, a binary downgrade is no longer simple because the metadata log uses 4.4-IV2 records. Keep the feature bump for after you’ve watched the cluster on the new binaries. If you’d rather move one feature at a time, upgrade --feature metadata.version=33 style flags do that instead of --release-version.
Restore min.insync.replicas after the feature bump
This one surprised us. Every broker had min.insync.replicas=2 in server.properties, yet after the feature upgrade the orders topic described with min.insync.replicas=1. The controller log had the answer: “Updating cluster configuration : min.insync.replicas -> 1”.
Enabling eligible leader replicas (ELR) moves min.insync.replicas to a cluster-level setting taken from the active controller’s static config. Our controllers did not set it, so the cluster default of 1 won over the brokers’ static 2. With acks=all producers that halves your durability guarantee without a single warning. The synonyms show the override clearly:

If you skipped the pre-set, put the cluster-wide default back with one dynamic config change. It takes effect immediately with no restart. Do not rerun it when the default is already right: the ELR docs warn that any update to the cluster-level value, even to the same number, clears all ELR state:
/opt/kafka/bin/kafka-configs.sh --bootstrap-server broker1:9092 --alter --entity-type brokers --entity-default --add-config min.insync.replicas=2
The dynamic default lives in the metadata log, so it survives controller restarts. Adding min.insync.replicas=2 to each controller.properties as well covers the case where you ever rebuild the quorum from scratch. Topics with their own min.insync.replicas override were not affected, so audit topics that depend on the cluster default first.
Test what old clients get from Kafka 4.x
Most write-ups say old clients receive UNSUPPORTED_VERSION. The protocol does define that error code, but it is not what the old Java client we tested showed. We pointed a Kafka 0.10.2.2 console producer at the 4.4 cluster:

The client retried three times with NETWORK_EXCEPTION and gave up with “The server disconnected before a response was received.” Teams that search client output for UNSUPPORTED_VERSION after the upgrade will find nothing and go chasing firewalls, which is why the JMX pre-check earlier matters more than the error.
The API ranges the broker advertises explain the confusion. You can check them with the tools that ship in 4.x:
/opt/kafka/bin/kafka-broker-api-versions.sh --bootstrap-server broker1:9092 | grep -E "Produce|Fetch\(|ListOffsets|OffsetCommit|OffsetFetch|JoinGroup"
Produce still advertises v0 upward. That is deliberate (KAFKA-18659): librdkafka checks for those versions to decide on compression support, so the broker lists them but rejects the requests. Fetch, on the other hand, starts at 4:
WARNING: kafka-broker-api-versions.sh is deprecated and will be removed in the next major release. Use 'kafka-cluster.sh api-versions' instead.
Produce(0): 0 to 13 [usable: 13],
Fetch(1): 4 to 18 [usable: 18],
ListOffsets(2): 1 to 11 [usable: 11],
OffsetCommit(8): 2 to 10 [usable: 10],
OffsetFetch(9): 1 to 10 [usable: 10],
JoinGroup(11): 0 to 9 [usable: 9],
For contrast, the Kafka 2.0.1 console producer returned no error against 4.4, and a 2.0.1 consumer group read back the three earlier test messages on payments. That client sits below the documented 2.1 floor, so treat it as luck rather than support. Non-Java clients have their own floors; KIP-896 lists librdkafka 1.8.2, Sarama 1.29.1, KafkaJS 1.15.0 and kafka-python 2.0.2 as the oldest that keep working.
Switch the controllers to a dynamic quorum
This part is optional. A migrated cluster keeps the static controller.quorum.voters list, so adding or replacing a controller means editing every node. Since 4.1 you can convert to a dynamic quorum, which needs kraft.version=1. The --release-version 4.4 upgrade above already set it, and the voters picked up directory IDs on their own:
CurrentVoters: [{"id": 3001, "directoryId": "d7B2zPgFOgLmfmKDWDNT8Q", "endpoints": ["CONTROLLER://controller1:9093"]}, {"id": 3002, "directoryId": "K8zYKvFSLNhJnh5FQU-g9g", "endpoints": ["CONTROLLER://controller2:9093"]}, {"id": 3003, "directoryId": "VEENqqqeWbYHyA73r8CJDw", "endpoints": ["CONTROLLER://controller3:9093"]}]
If you upgraded features one at a time, run kafka-features.sh upgrade --feature kraft.version=1 first. Then, on all six nodes, replace the controller.quorum.voters line with a bootstrap list:
controller.quorum.bootstrap.servers=controller1:9093,controller2:9093,controller3:9093
Restart the controllers first, then the brokers (13 seconds per controller and 20 to 22 per broker for us). Voters already carry real directory IDs after the --release-version 4.4 bump, so the proof of the swap is that every node restarted on the new setting and the quorum still replicates:
/opt/kafka/bin/kafka-metadata-quorum.sh --bootstrap-controller controller1:9093 describe --replication
All six nodes at lag 0 confirms the swap. From here, controller changes go through kafka-metadata-quorum.sh add-controller and remove-controller without touching configs on the other nodes:
NodeId DirectoryId LogEndOffset Lag LastFetchTimestamp LastCaughtUpTimestamp Status
3001 d7B2zPgFOgLmfmKDWDNT8Q 3195 0 1796060803628 1796060803628 Leader
3002 K8zYKvFSLNhJnh5FQU-g9g 3195 0 1796060803304 1796060803304 Follower
3003 VEENqqqeWbYHyA73r8CJDw 3195 0 1796060803306 1796060803306 Follower
1 M31Joq_YWthFPhfJqpa83g 3195 0 1796060803305 1796060803305 Observer
3 F5D7bJqAKmsEmlBdKT2qLg 3195 0 1796060803305 1796060803305 Observer
2 eHHd3qkvqYAT5cGKhegi9A 3195 0 1796060803306 1796060803306 Observer
The producer kept its 100 records per second through both restart rounds. Across every roll in the run, its log counted 73 NOT_LEADER_OR_FOLLOWER and 4 OUT_OF_ORDER_SEQUENCE_NUMBER warnings (the sequence warnings all came during the 4.x broker roll), and each one was retried with no failed send.
The consumer side was just as quiet. After the 4.4 roll, kafka-consumer-groups.sh --describe --group orders-app still showed the same member, console-consumer-9fdd2ebf, holding all six orders partitions, with lag of 0 on four of them and 10 and 20 records on the other two. It had read straight through two version rolls and the move from ZooKeeper to KRaft without being kicked out of its group.
Fix the errors you can hit on the way
These are the messages we saw in the lab, or that the 3.9 docs warn about, with what each one means for you and what you change to clear it.
“No brokers are known to KRaft, waiting for brokers to register”
This is expected right after the controllers start, and it repeats until every ZooKeeper broker has restarted with the migration settings. If it keeps printing after the broker roll, check a broker’s log for connection errors to port 9093. Usually controller.listener.names or the CONTROLLER entry in listener.security.protocol.map is missing.
Migration stalls with a malformed /migration znode
Clusters that ran the ZooKeeper security migration tool at some point can stall here (KAFKA-19480). The documented workaround is to stop, run delete /migration in zookeeper-shell.sh, and start the migration again.
“The server disconnected before a response was received”
Against a 4.x broker from a client that was fine on 3.9, this is almost always a protocol version the broker removed. Network problems would show up from newer clients too. Upgrade the client library you ship, then confirm with the DeprecatedRequestsPerSec check on a cluster that still runs 3.9.
min.insync.replicas shows 1 after the upgrade
That’s the ELR change covered above. Look for DYNAMIC_DEFAULT_BROKER_CONFIG:min.insync.replicas=1 in the synonyms, then set the entity default back to your value. For a broader look at how Kafka compares with leaner brokers after a move like this, see our Kafka vs Redpanda benchmarks.
Run the whole migration from one checklist
This is the order we followed, start to finish. Each line is a step you can tick off in a change ticket:
- Confirm single
log.dirs, Java 17 and free controller node IDs - Pin
inter.broker.protocol.versionto the current version - Roll brokers to 3.9.2, then set the protocol to 3.9 and roll again
- Check
DeprecatedRequestsPerSecon every broker and upgrade flagged clients - Read
/cluster/idand format three controllers with it - Start the controllers and confirm PRE_MIGRATION
- Add the migration settings to the brokers and roll them
- Confirm DUAL_WRITE in the controller log and
ZkWriteBehindLagat 0 - Save
/controller_epoch,/migrationand/controller - Switch the brokers to
process.roles=brokerand roll them - Soak in dual-write mode for as long as your change policy needs
- Remove the ZooKeeper lines from the controllers and roll them
- Confirm
ZkMigrationStateis 3, then retire ZooKeeper - Roll controllers, then brokers, to the 4.x release
- Set the cluster default for
min.insync.replicas - Run
kafka-features.sh upgradewith--dry-runfirst, then for real - Check
min.insync.replicason your topics - Optionally switch to
controller.quorum.bootstrap.servers
Steps 7 to 11 are the only ones with real risk, and they are also the ones you can undo. Everything after step 12 is a routine KRaft upgrade. The KRaft operations page for 3.9 keeps the full revert table if you need it mid-change. If you want the protocol and controller internals in more depth, our list of Kafka and Spark books has the titles we’d hand a team taking over a cluster.