Skip to main content
Install and run Kafka in KRaft mode on Windows in 15 minutes KRaft mode runs Kafka without ZooKeeper, simplifying deployment and reducing resource requirements. This guide walks you through setting up a single-node KRaft cluster using WSL2. What you’ll learn:
  • How to set up WSL2 on Windows
  • How to generate a cluster ID and format storage
  • How to start Kafka in KRaft mode
  • How to configure your PATH for CLI access
Native Windows is not recommendedKafka has known issues when running directly on Windows due to missing POSIX features. Always use WSL2 or Docker for Windows installations.
KRaft mode became production-ready in Kafka 3.3. For maximum compatibility with older tutorials and tools, see the Windows ZooKeeper installation guide.

Installation overview

Step 1: Install WSL2

WSL2 provides a Linux environment on Windows without a virtual machine. Open PowerShell as Administrator and run:
wsl --install
This installs Ubuntu by default. Restart your computer when prompted. After restart, open Ubuntu from the Start menu and create a Linux username and password.
For troubleshooting WSL2 issues, see the Microsoft troubleshooting guide.

Step 2: Disable IPv6 on WSL2

WSL2 has a networking issue that prevents external programs from connecting to Kafka. Disable IPv6 to fix this:
sudo sysctl -w net.ipv6.conf.all.disable_ipv6=1
sudo sysctl -w net.ipv6.conf.default.disable_ipv6=1

Step 3: Install Java JDK 11

In your WSL2 Ubuntu terminal:
wget -O- https://apt.corretto.aws/corretto.key | sudo apt-key add -
sudo add-apt-repository 'deb https://apt.corretto.aws stable main'
sudo apt-get update
sudo apt-get install -y java-11-amazon-corretto-jdk
Verify the installation:
java -version
Expected output:
openjdk version "11.0.10" 2021-01-19 LTS
OpenJDK Runtime Environment Corretto-11.0.10.9.1 (build 11.0.10+9-LTS)
OpenJDK 64-Bit Server VM Corretto-11.0.10.9.1 (build 11.0.10+9-LTS, mixed mode)

Step 4: Download and extract Kafka

wget https://archive.apache.org/dist/kafka/3.0.0/kafka_2.13-3.0.0.tgz
tar -xzf kafka_2.13-3.0.0.tgz
mv kafka_2.13-3.0.0 ~
Or download manually from kafka.apache.org/downloads.

Step 5: Generate cluster ID

KRaft clusters require a unique identifier:
~/kafka_2.13-3.0.0/bin/kafka-storage.sh random-uuid
This returns a UUID like 76BLQI7sT_ql1mBfKsOk9Q. Save this value.

Step 6: Format storage

Format the log directory using your cluster ID (replace <uuid> with your generated UUID):
~/kafka_2.13-3.0.0/bin/kafka-storage.sh format \
  -t <uuid> \
  -c ~/kafka_2.13-3.0.0/config/kraft/server.properties
This formats the directory specified in log.dirs (default: /tmp/kraft-combined-logs).

Step 7: Start Kafka

~/kafka_2.13-3.0.0/bin/kafka-server-start.sh ~/kafka_2.13-3.0.0/config/kraft/server.properties
Keep this terminal window open. Kafka is now running at localhost:9092 in KRaft mode.

Step 8: Configure PATH

Add Kafka binaries to your PATH:
echo 'export PATH="$PATH:$HOME/kafka_2.13-3.0.0/bin"' >> ~/.bashrc
source ~/.bashrc
Verify the setup:
kafka-topics.sh --version
See it in practice with ConduktorConduktor Console can connect to your WSL2 KRaft cluster at localhost:9092 from Windows for visual topic management.

Next steps