kfk-0.1.2 is not a library.
kfk — Kafka CLI
kfk is a pure Rust command-line tool for Apache Kafka cluster management. It supports topic operations, message produce/consume, consumer group management, and secure connections (TLS, SASL).
Features
- Cluster management — List brokers, describe cluster metadata
- Topic operations — List, describe, create, delete topics
- Produce messages — Send records from stdin (text or JSON)
- Consume messages — Tail messages with offset control and header filtering
- Consumer groups — List, describe, commit offsets, delete groups
- Authentication — SASL/PLAIN, SCRAM-SHA-256/512
- Encryption — TLS with custom CA, client certs, and insecure mode
- Config profiles — Save multiple cluster configs in
~/.kfk/config.toml - Shell completions — Generate completions for bash, zsh, fish, etc.
Installation
via Cargo (recommended)
From source
# binary at target/release/kfk
Quick Start
1. Connect to a plaintext cluster
# List brokers
# List topics
# Create a topic
# Describe a topic
2. Produce messages
# Text input (each line is one record)
|
# JSON input
| \
# With explicit key
| \
# With headers
| \
3. Consume messages
# Tail 10 messages from earliest offset
# Continuous consumption with a consumer group
Authentication & Security
SASL/PLAIN
The security protocol is automatically upgraded to SASL_PLAINTEXT when SASL credentials are provided.
SASL/SCRAM
TLS
# TLS with default system CA
# TLS with custom CA
# TLS with mTLS (client certificate)
# Insecure TLS (skip certificate verification)
SASL + TLS
Configuration Profiles
Save frequently used cluster settings to avoid repeating flags:
# Add a cluster config
# Switch to a config
# List all configs
# Then use without --brokers
Configs are stored in ~/.kfk/config.toml.
Command Reference
| Command | Description |
|---|---|
node ls |
List all brokers |
topic ls |
List all topics |
topic create <name> |
Create a topic |
topic describe <name> |
Describe topic partitions |
topic delete <name> |
Delete a topic |
produce <topic> |
Produce messages (reads stdin) |
consume <topic> |
Consume messages |
group ls |
List consumer groups |
group describe <id> |
Describe a consumer group |
group commit <id> |
Commit/reset offset |
group delete <id> |
Delete a consumer group |
config add-cluster <name> |
Save a cluster config |
config remove-cluster <name> |
Remove a config |
config select <name> |
Switch active config |
config list |
List all configs |
completion <shell> |
Generate shell completion |
Global Options
| Flag | Description |
|---|---|
-b, --brokers |
Broker addresses (comma separated) |
-c, --cluster |
Cluster config name |
-v, --verbose |
Verbose output |
--security-protocol |
PLAINTEXT / SSL / SASL_PLAINTEXT / SASL_SSL |
--sasl-mechanism |
PLAIN / SCRAM-SHA-256 / SCRAM-SHA-512 |
--sasl-username |
SASL username |
--sasl-password |
SASL password |
--tls |
Enable TLS |
--tls-ca |
TLS CA certificate file |
--tls-cert |
TLS client certificate file |
--tls-key |
TLS client key file |
--tls-insecure |
Skip certificate verification |
Shell Completions
# Bash
# Zsh
# Fish
Building from Source
Minimum supported Rust version: 1.85
License
This project is dual-licensed under either:
- MIT License (LICENSE-MIT)
- Apache License, Version 2.0 (LICENSE-APACHE)
at your option.