Introduction to Kafka in Podman

Kafka is a powerful event streaming platform. In this learning path, you will learn about Kafka and how it can be run in a container in Podman. This understanding is a good prerequisite to running Kafka in Red Hat OpenShift.

Access the Developer Sandbox

In this lesson, you will start a Kafka host and run it in a container. and run it on your machine.

What is Kafka?

Before you start using Podman and running Kafka, you need the following basic information.

At a high level, Kafka is an event processing system that allows you to send messages from one or more producers and retrieve the messages in the order sent from one or more consumers. You can segregate messages by an assigned topic, allowing the consumer to receive only the messages pertinent to its particular use. Kafka supports automatic replication across multiple hosts to support a high availability environment. You can run a simple Kafka host in a Linux container, which is useful when developing applications. In a production environment that includes Red Hat OpenShift, the product Streams for Apache Kafka on OpenShift is available.

In this lesson, you will start a Kafka host running in a container using Podman. If you search through container registries such as Docker Hub (hub.docker.com) and Quay (quay.io), you will find multiple images of Kafka. For our purposes, we will use the official Kafka images as supplied by the Apache Software Foundation. The fully qualified path is docker.io/apache/kafka:4.1.0.

At the command line, pull the image to your machine by running the following command:

podman pull docker.io/apache/kafka:4.1.0

You should see results like this:

Resolving "apache/kafka" using unqualified-search registries (/etc/containers/registries.conf.d/999-podman-machine.conf)
Trying to pull docker.io/apache/kafka:4.1.0...
Getting image source signatures
Copying blob sha256:f5746fcc910abd77c93411e4d826e0b600f5f055aa6c4d641670ee7bcbb669af
Copying blob sha256:6a46580b98941ec4960dce678993b8f83a0b4d2d146c9d4e59e3aa6e788c13e2
Copying blob sha256:9824c27679d3b27c5e1cb00a73adb6f4f8d556994111c12db3c5d61a0c843df8
Copying blob sha256:57f9d657519484ce2f35f23c98dec4ef4411ffbb8df53ae594b3563de635b94c
Copying blob sha256:cf466e9ba1cfaf9351b9b793d92033975eb18f8b2ffadf9b5720caea1fcb9f48
Copying blob sha256:fb760d495f93020b467e7edca17a273394c877a25c14ce0d90a9a039e90bcb08
Copying blob sha256:60930a4e944b81632b995532a6cb0665dddcc670f80f0e0f2aa9e68656185424
Copying blob sha256:56f63c25ccc7f787d4fcfe9788d9c7457ab83b3c49aa5aa89a34dd41857f1bc6
Copying blob sha256:5acb7b35446c131e7dab8da231c92c4d4e672818a22793dcaebdb1137ee31307
Copying blob sha256:5621607a4a736e8a1ce0872ab36f3adfef844172a0fcb73d0453db1ade6b63e1
Copying blob sha256:1e7ff3c422db246741208cc3992495d58463b860d0668f0dda06e05be34ca6f8
Copying config sha256:a183a690a3a69ad7fadf3881bdb9ac7f926790d1249352c0ca4150718dfb295f
Writing manifest to image destination
A183a690a3a69ad7fadf3881bdb9ac7f926790d1249352c0ca4150718dfb295f

Prove your success by running the following command:

podman images

You should see results like this:

REPOSITORY              TAG         IMAGE ID      CREATED      SIZE
docker.io/apache/kafka  4.1.0       a183a690a3a6  4 weeks ago  439 MB

The image is stored on your local machine. It can now be started with no extra parameters needed.

Run the following command:

podman run -it --net kafkanet --name kafkaserver -p 9092-9093:9092-9093 -e KAFKA_NODE_ID=1 -e KAFKA_PROCESS_ROLES=broker,controller -e KAFKA_LISTENERS=PLAINTEXT://:9092,CONTROLLER://:9093 -e KAFKA_ADVERTISED_LISTENERS=PLAINTEXT://kafkaserver:9092 -e KAFKA_LISTENER_SECURITY_PROTOCOL_MAP=CONTROLLER:PLAINTEXT,PLAINTEXT:PLAINTEXT,EXTERNAL:PLAINTEXT -e KAFKA_CONTROLLER_QUORUM_VOTERS=1@kafkaserver:9093 -e KAFKA_CONTROLLER_LISTENER_NAMES=CONTROLLER -e KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR=1 -e KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR=1 -e KAFKA_TRANSACTION_STATE_LOG_MIN_ISR=1 docker.io/apache/kafka:4.1.0

You will see several messages on your terminal. The final message should be similar to the following, indicating that the Kafka server is up and running:

[2025-09-25 17:19:47,064] INFO [KafkaRaftServer nodeId=1] Kafka Server started (kafka.server.KafkaRaftServer)

Summary

Congratulations. You successfully downloaded and started a Kafka server on your machine. It is running and waiting for access by one or more producers and/or one or more consumers. The next lesson in this learning path will start a producer to use this Kafka server and produce messages.

For more information related to this lesson, visit:

Previous resource
Overview: Introduction to Kafka in Podman
Next resource
Run a Kafka producer application