The simplest Apache Kafka containerization solution
7.8K
v3.5.0, v3.5, latestv3.4.1, v3.4v3.3.2, v3.3Apache Kafka is an open-source distributed event streaming platform used by thousands of companies for high-performance data pipelines, streaming analytics, data integration, and mission-critical applications.
More than 80% of all Fortune 100 companies trust, and use Kafka.
KRaft, say goodbye to ZooKeeper.kafka server instanceStarting a Kafka instance is simple:
docker run -d --name kafka-server --network host sir5kong/kafka
docker volume create kafka-data
docker run -d --name kafka-server \
--network host \
-v kafka-data:/opt/kafka/data \
sir5kong/kafka
The default listener port of the broker is
9092
docker volume create kafka-data
docker run -d --name kafka-server \
--network host \
-v kafka-data:/opt/kafka/data \
--env KAFKA_CONTROLLER_LISTENER_PORT=29091 \
--env KAFKA_BROKER_LISTENER_PORT=29092 \
sir5kong/kafka
version: "3"
volumes:
kafka-data: {}
## bootstrap-server: ${KAFKA_HOST_IP_ADDR}:9092
services:
kafka:
image: sir5kong/kafka:v3.5
restart: always
network_mode: host
volumes:
- kafka-data:/opt/kafka/data
environment:
- KAFKA_HEAP_OPTS=-Xmx512m -Xms512m
#- KAFKA_CONTROLLER_LISTENER_PORT=19091
#- KAFKA_BROKER_LISTENER_PORT=9092
| Variable | Default | Description |
|---|---|---|
KAFKA_CLUSTER_ID | Random | Cluster ID |
KAFKA_BROKER_LISTENER_PORT | 9092 | broker listener port. This will not work if KAFKA_CFG_LISTENERS is configured |
KAFKA_CONTROLLER_LISTENER_PORT | 19091 | controller listener port. This will not work if KAFKA_CFG_LISTENERS is configured |
KAFKA_HEAP_OPTS | null | Kafka Java Heap size. For example -Xmx512m -Xms512m |
Any environment variable beginning with KAFKA_CFG_ will be mapped to its corresponding Apache Kafka key.
For example, use KAFKA_CFG_LISTENERS in order to set listeners or KAFKA_CFG_ADVERTISED_LISTENERS in order to configure advertised.listeners.
Variable examples:
| Variable | Key |
|---|---|
KAFKA_CFG_PROCESS_ROLES | process.roles |
KAFKA_CFG_LISTENERS | listeners |
KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP | listener.security.protocol.map |
KAFKA_CFG_ADVERTISED_LISTENERS | advertised.listeners |
KAFKA_CFG_CONTROLLER_QUORUM_VOTERS | controller.quorum.voters |
KAFKA_CFG_LOG_RETENTION_HOURS | log.retention.hours |
log.dirandlog.dirsare locked, you cannot overwrite them
helm repo add kafka-repo https://helm-charts.itboon.top/kafka
helm repo update kafka-repo
helm upgrade --install kafka \
--namespace kafka-demo \
--create-namespace \
--set broker.combinedMode.enabled="true" \
--set broker.persistence.enabled="false" \
kafka-repo/kafka
helm upgrade --install kafka \
--namespace kafka-demo \
--create-namespace \
--set broker.persistence.size="20Gi" \
kafka-repo/kafka
Persistence storage is used by default.
helm upgrade --install kafka \
--namespace kafka-demo \
--create-namespace \
--set controller.replicaCount="3" \
--set broker.replicaCount="3" \
--set broker.heapOpts="-Xms4096m -Xmx4096m" \
--set broker.resources.requests.memory="8Gi" \
--set broker.resources.limits.memory="16Gi" \
kafka-repo/kafka
More values please refer to examples/values-production.yml
Enable Kubernetes external cluster access to Kafka brokers.
helm upgrade --install kafka \
--namespace kafka-demo \
--create-namespace \
--set broker.external.enabled="true" \
--set broker.external.service.type="LoadBalancer" \
--set broker.external.domainSuffix="kafka.example.com" \
kafka-repo/kafka
Configure your DNS record to complete this deployment.
Content type
Image
Digest
sha256:f67611aac…
Size
194.9 MB
Last updated
over 3 years ago
docker pull sir5kong/kafka