There are 2 variants one is slim and can be used for producing / consuming messages and the other one is the full version which includes also build tools maven and gradle.
docker run -it --rm spoud/kafka-toolbox:slim
.shEvery kafka-* tool completes on Tab: options, sub-commands (kafka-features, kafka-storage, kafka-metadata-quorum, ...), topic configs for --config and kafka-configs --add-config (per entity type), client configs for --command-property, formatter properties, enum values and file paths.
The tables are generated at image build time from each tool's --help (toolbox-slim/kafka-completion-gen.sh), so they match the Kafka version in the image.
Options already on the command line aren't offered again, except the repeatable ones (--config, --property, --add-config, ...). Once an action is given (kafka-topics --create, kafka-consumer-groups --reset-offsets, kafka-acls --add, ...), the tool's other actions are hidden. Other rules between options (which options an action requires or ignores) are not checked.
Topic and group names after --topic and --group are read from the cluster.
The tool uses --bootstrap-server and --command-config from the command line, or falls back to $BOOTSTRAP_SERVER/$BOOTSTRAP_SERVERS with $CLIENT_PROPERTIES (default /tmp/client.properties).
The environment variables are offered first, as the variable reference rather than its value, so a copied command line works against another cluster: $BOOTSTRAP_SERVERS (or $BOOTSTRAP_SERVER) after --bootstrap-server, $CLIENT_PROPERTIES (else /tmp/client.properties) after --command-config, --consumer.config and --producer.config, $TOPIC after --topic and $CONSUMER_GROUP after --group.
A lookup takes about 1.2 seconds: the images ship an AppCDS archive (/opt/kafka/kafka-tools.jsa) that roughly halves the start time of every Kafka CLI tool. It only matches the default classpath, so with your own CLASSPATH set the tools start at normal speed. The result is kept in the shell for 60 seconds (KAFKA_COMPLETION_CACHE_SECONDS), and a lookup gives up after 10 seconds (KAFKA_COMPLETION_TIMEOUT).
Every interactive bash prints the commit and build time of the image, so an error can be matched to the git history and an old image is easy to spot:
kafka-toolbox built 2026-12-02T11:21:27Z (0 days ago) from commit 4d891380a518ad4e61c1af826efcc981eb7bee11
https://github.com/spoud/spoud-kafka-toolbox/commit/4d891380a518ad4e61c1af826efcc981eb7bee11
The same values are in $TOOLBOX_GIT_COMMIT and $TOOLBOX_BUILD_TIME and in the image labels org.opencontainers.image.revision and org.opencontainers.image.created.
CI sets them through docker-bake.hcl; for a local build run GITHUB_SHA=$(git rev-parse HEAD) docker buildx bake.
The slim image has no dig: the dig alias says so and runs getent hosts instead.
docker run -it --rm spoud/kafka-toolbox:latest
When environment variables are set, they will be used by the various tools in the toolbox to connect to the Kafka cluster and perform their operations.
| Variable | Meaning |
|---|---|
| BOOTSTRAP_SERVER / BOOTSTRAP_SERVERS | Hostname:port or comma-separated list of brokers used to connect to the Kafka cluster |
| PROTOCOL | Protocol to be used for the connection (e.g. PLAINTEXT, SASL_SSL) |
| KAFKA_SASL_MECHANISM | SASL mechanism to be used (e.g. PLAIN, SCRAM-SHA-256) |
| KAFKA_USER | Username for SASL authentication |
| KAFKA_PASSWORD | Password for SASL authentication |
| TLS_CA | Optional path or inline content for TLS CA to configure mTLS / TLS trust for clients (applied to kafkactl, kcat, kaf, kafi) |
| TLS_CERT | Optional path or inline content for client TLS certificate (applied to kafkactl, kcat, kaf, kafi) |
| TLS_KEY | Optional path or inline content for client TLS private key (applied to kafkactl, kcat, kaf, kafi) |
| TLS_INSECURE | Optional boolean (true/false). If true, skip TLS verification for tools that support this option (use with caution) |
| CCLOUD_API_KEY | Confluent Cloud API Key |
| CCLOUD_API_SECRET | Confluent Cloud API Secret |
| SCHEMA_REGISTRY_URL | URL to the schema registry |
| SR_API_KEY | Schema Registry API Key |
| SR_API_SECRET | Schema Registry API Secret |
| CONNECT_URL | URL to kafka connect rest endpoint |
For Strimzi-managed OAUTHBEARER listeners, the slim and full images now also ship the Strimzi OAuth client classes, including io.strimzi.kafka.oauth.client.JaasClientOauthLoginCallbackHandler. That enables JAAS configs using oauth.access.token.location with projected or pre-obtained JWT token files.
For Keycloak federated client authentication, the slim and full images also ship
io.spoud.oauth.KeycloakFederatedLoginCallbackHandler from
kafka-oauth-extensions, so Kubernetes workloads can exchange a projected
ServiceAccount token for a Keycloak access token without a static client secret.
The toolbox image downloads kafka-oauth-extensions from the published GitHub
release artifacts during the Docker build. The default version is
1.5-SNAPSHOT, which contains the federated Keycloak callback handler.
You can run the toolbox on kubernetes cluster as a pod. Here is an example manifest file:
kubectl apply -f - <<EOF
apiVersion: apps/v1
kind: Deployment
metadata:
name: kafka-toolbox-deployment
spec:
selector:
matchLabels:
app: kafka-toolbox
replicas: 1
template:
metadata:
labels:
app: kafka-toolbox
spec:
securityContext:
fsGroup: 1000660000 # choose an allowed GID from your cluster policy
volumes:
- name: home
emptyDir:
sizeLimit: "200Mi"
- name: tmp
emptyDir:
sizeLimit: "200Mi"
containers:
- name: kafka-toolbox
image: spoud/kafka-toolbox:latest
command: ["/bin/bash"]
args: ["-c", "mkdir -p /tmp /home/kafka && chmod 1777 /tmp || true && cp -R /etc/skel/. /home/kafka/ && chown -R $(id -u):$(id -g) /home/kafka/ || true; sleep infinity"]
volumeMounts:
- name: home
mountPath: /home/kafka
- name: tmp
mountPath: /tmp
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
privileged: false
runAsNonRoot: true
capabilities:
drop:
- ALL
seccompProfile:
type: RuntimeDefault
resources:
requests:
memory: "256Mi"
cpu: "250m"
ephemeral-storage: "200Mi"
limits:
memory: "1Gi"
cpu: "2000m"
ephemeral-storage: "1Gi"
EOF
kubectl apply -f - <<EOF
apiVersion: apps/v1
kind: Deployment
metadata:
name: kafka-toolbox-slim-deployment
spec:
selector:
matchLabels:
app: kafka-toolbox-slim
replicas: 1
template:
metadata:
labels:
app: kafka-toolbox-slim
spec:
securityContext:
fsGroup: 1000660000 # choose an allowed GID from your cluster policy
volumes:
- name: home
emptyDir:
sizeLimit: "200Mi"
- name: tmp
emptyDir:
sizeLimit: "200Mi"
containers:
- name: kafka-toolbox-slim
image: spoud/kafka-toolbox:slim
command: ["/bin/bash"]
args: ["-c", "mkdir -p /tmp /home/kafka && chmod 1777 /tmp || true && cp -R /etc/skel/. /home/kafka/ && chown -R $(id -u):$(id -g) /home/kafka/ || true; sleep infinity"]
volumeMounts:
- name: home
mountPath: /home/kafka
- name: tmp
mountPath: /tmp
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
privileged: false
runAsNonRoot: true
capabilities:
drop:
- ALL
seccompProfile:
type: RuntimeDefault
resources:
requests:
memory: "256Mi"
cpu: "250m"
ephemeral-storage: "200Mi"
limits:
memory: "1Gi"
cpu: "2000m"
ephemeral-storage: "1Gi"
EOF
You can use the ksqlDB datagen tool to generate sample data into your Kafka topics. Here is an example command to generate data:
ksql-datagen quickstart=orders format=avro topic=orders maxInterval=1000 iterations=1000
docker pull spoud/kafka-toolbox:latest