Self-host Apache Kafka with Levelrail

A single broker Apache Kafka in KRaft mode (no ZooKeeper) on the official image, with a persistent volume. It is not published on the host and speaks plaintext, so reach it only from other services in this project at kafka:9092.

  • Authorapache
  • LicenceApache-2.0
  • Memory1 GiB
  • Services1

How to self-host Apache Kafka

  1. Pull the images

    One image is pulled on your server.

    Show images
    • apache/kafka:3.8.0
  2. Create the app

    One service starts in a single Compose app, with 1 named volume mount for your data, on port 9092.

  3. Fill in the secrets

    12 settings are preset, you do not have to fill in anything.

  4. Open it

    Without a domain the app gets an sslip.io address; add --domain SERVICE=HOST to use your own.

After the first start

  • Point producers and consumers in the same project at kafka:9092. Topics are created on first use.

Apache Kafka requirements

Memory
About 1 GiB
Architectures
amd64 unknown, arm64 unknown
Ports
9092
Domain
Optional, an sslip.io address is used without one
Settings
none to fill in
License
Apache-2.0, permissive license
  • Listed. It is in the catalog but not verified. Back up the data volume before changing an image tag.

Install Levelrail first

On a server with Levelrail running, run the command above, or open the dashboard: Apps, New app, Browse templates, then Apache Kafka. New to Levelrail? Install it on a fresh VPS first.

docker pull ghcr.io/glincker/levelrail:latest

Then levelrail-cli login --device. See Getting started and the Apache Kafka docs page.

Deploy Apache Kafka your way

Every format below deploys the same pinned images. Pick the one that fits how you work.

Deploy Apache Kafka from the CLI

levelrail-cli templates deploy kafka --name my-kafka

Deploy Apache Kafka with the API

Create a token in the dashboard first. This one-click route deploys it as a trial app you can keep or remove.

curl -X POST -H "Authorization: Bearer $TOKEN" \
  https://levelrail.example.com/api/v1/service-templates/kafka/deploy

Apache Kafka configuration

Apache Kafka services

ServiceImagePortsVolumes
kafka apache/kafka:3.8.0 9092 kafka_data -> /var/lib/kafka/data

Apache Kafka environment variables

VariableServiceValue
KAFKA_ADVERTISED_LISTENERS kafka Preset by the template
KAFKA_CONTROLLER_LISTENER_NAMES kafka Preset by the template
KAFKA_CONTROLLER_QUORUM_VOTERS kafka Preset by the template
KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS kafka Preset by the template
KAFKA_LISTENERS kafka Preset by the template
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP kafka Preset by the template
KAFKA_LOG_DIRS kafka Preset by the template
KAFKA_NODE_ID kafka Preset by the template
Show all 12 variables
  • KAFKA_OFFSETS_TOPIC_REPLICATION_FACTORkafkaPreset by the template
  • KAFKA_PROCESS_ROLESkafkaPreset by the template
  • KAFKA_TRANSACTION_STATE_LOG_MIN_ISRkafkaPreset by the template
  • KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTORkafkaPreset by the template

Ports and volumes

Ports
9092
Volumes
1 named mount: kafka_data -> /var/lib/kafka/data

Apache Kafka FAQ

How much memory does Apache Kafka need?

The catalog lists about 1 GiB of memory for Apache Kafka.

Does Apache Kafka run on arm64?

For Apache Kafka, arm64 support is not confirmed; amd64 is unknown.

What licence is Apache Kafka under?

Apache Kafka is licensed under Apache-2.0, which is permissive, with few conditions on reuse.

Does Apache Kafka need configuration before it starts?

No. The template fills in its own defaults.

Which ports does Apache Kafka use?

Apache Kafka listens on port 9092 inside the stack.

Where does Apache Kafka keep its data?

In a named volume: kafka_data mounted at /var/lib/kafka/data.

Can I deploy Apache Kafka on Dokploy or Dokku?

The services and pinned images on this page can be run on any Docker host. The public Dokploy templates list we compared does not have an entry with the same id for Apache Kafka, so on Dokploy you would use a Docker Compose application with the file from this page. Dokku deploys container images with its own commands, so the pinned image apache/kafka:3.8.0 is what you deploy there.

levelrail-cli templates deploy kafka --name my-kafka