{"id":45679801,"url":"https://github.com/janfonas/kafka-admin-cli","last_synced_at":"2026-02-24T14:01:28.312Z","repository":{"id":278342212,"uuid":"935306231","full_name":"janfonas/kafka-admin-cli","owner":"janfonas","description":"A command-line interface for Apache Kafka administration, built with the Franz-go client library. Designed as a management companion to kcat, providing comprehensive tools for Kafka cluster administration.","archived":false,"fork":false,"pushed_at":"2025-12-10T08:55:49.000Z","size":654,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-10T11:20:41.096Z","etag":null,"topics":["cli","kafka"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/janfonas.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-02-19T08:30:28.000Z","updated_at":"2025-12-10T08:46:03.000Z","dependencies_parsed_at":"2025-02-19T09:39:53.373Z","dependency_job_id":null,"html_url":"https://github.com/janfonas/kafka-admin-cli","commit_stats":null,"previous_names":["janfonas/kafka-admin-cli"],"tags_count":23,"template":false,"template_full_name":null,"purl":"pkg:github/janfonas/kafka-admin-cli","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/janfonas%2Fkafka-admin-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/janfonas%2Fkafka-admin-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/janfonas%2Fkafka-admin-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/janfonas%2Fkafka-admin-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/janfonas","download_url":"https://codeload.github.com/janfonas/kafka-admin-cli/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/janfonas%2Fkafka-admin-cli/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29785300,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-24T10:45:18.109Z","status":"ssl_error","status_checked_at":"2026-02-24T10:45:09.911Z","response_time":75,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","kafka"],"created_at":"2026-02-24T14:01:25.642Z","updated_at":"2026-02-24T14:01:28.303Z","avatar_url":"https://github.com/janfonas.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Kafka Admin CLI (kac)\n\nA command-line interface for Apache Kafka administration, built with the Franz-go client library. Designed as a management companion to [kcat](https://github.com/edenhill/kcat), providing comprehensive tools for Kafka cluster administration.\n\n## Overview\n\n`kac` provides a streamlined interface for managing:\n- Kafka Topics\n- Access Control Lists (ACLs)\n- Consumer Groups\n\nBuilt with security in mind, supporting SASL authentication and TLS encryption.\n\n## Quick Start\n\n### Installation\n\n#### Pre-compiled Binaries (Recommended)\nDownload the latest pre-compiled binary for your platform from the [GitHub Releases](https://github.com/janfonas/kafka-admin-cli/releases) page.\n\n```bash\n# Linux (x86_64)\ncurl -L https://github.com/janfonas/kafka-admin-cli/releases/latest/download/kafka-admin-cli_Linux_x86_64.tar.gz | tar xz\nsudo mv kac /usr/local/bin/\n\n# macOS (Apple Silicon)\ncurl -L https://github.com/janfonas/kafka-admin-cli/releases/latest/download/kafka-admin-cli_Darwin_arm64.tar.gz | tar xz\nsudo mv kac /usr/local/bin/\n\n# Windows (x86_64)\n# Download the ZIP file from the releases page and extract kac.exe\n```\n\n#### Build from Source\n```bash\n# Using go install\ngo install github.com/janfonas/kafka-admin-cli@latest\n\n# Or clone and build\ngit clone https://github.com/janfonas/kafka-admin-cli.git\ncd kafka-admin-cli\n./build.sh\n```\n\n### Basic Usage\n\n```bash\n# List topics\nkac get topics\n\n# Create a topic\nkac create topic mytopic --partitions 3 --replication-factor 1\n\n# Manage consumer groups\nkac get consumergroups\n```\n\n## Features\n\n### Topic Management\n- Create topics with custom partitions and replication factors\n- Modify topic configuration\n- Delete topics\n- List all topics\n- View detailed topic configuration\n- Export topics as Strimzi `KafkaTopic` CRD YAML (`-o strimzi`)\n\n### ACL Management\n- Create and delete ACLs\n- Modify ACLs\n- List all ACLs\n- View detailed ACL information with optional filters\n- Support for various resource types and operations\n- Export ACLs as Strimzi `KafkaUser` CRD YAML (`-o strimzi`)\n\n### Consumer Group Management\n- List all consumer groups\n- View detailed consumer group information\n  - Member assignments\n  - Partition offsets\n  - Consumer lag\n- Modify consumer group offsets\n\n### Output Formats\n- **table** (default) — human-readable tabular output\n- **strimzi** — Strimzi CRD YAML manifests, ready to apply with `kubectl`\n\nWhen using a structured output format (e.g. `strimzi`), connection status messages\nare suppressed so output can be safely piped to tools like `yq` or `kubectl apply`.\n\n### Shell Completion\nDynamic shell completion for bash, zsh, fish, and PowerShell. Tab-complete topic\nnames, consumer group IDs, ACL resource types, principal names, output formats,\nand profile names — all fetched live from your Kafka cluster.\n\n```bash\n# Bash\nsource \u003c(kac completion bash)\n\n# Zsh (add to ~/.zshrc)\nsource \u003c(kac completion zsh)\n\n# Fish\nkac completion fish | source\n\n# PowerShell\nkac completion powershell | Out-String | Invoke-Expression\n```\n\n## Authentication and Security\n\n### Supported Authentication Methods\n- SASL/SCRAM-SHA-512 (default)\n- SASL/PLAIN\n- TLS with custom CA certificates\n- TLS with self-signed certificates\n\n### Credential Storage (Recommended)\n\nStore your credentials securely in your system's keyring for convenient reuse:\n\n```bash\n# Login and store credentials (uses system keyring - Keychain/Secret Service/Credential Manager)\nkac login --brokers kafka1:9092 --username alice\n# Password will be prompted securely\n\n# Now use commands without credentials\nkac get topics\nkac get consumergroups\n\n# Use named profiles for multiple environments\nkac login --profile prod --brokers prod-kafka:9092 --username alice\nkac login --profile dev --brokers dev-kafka:9092 --username bob\n\n# List all stored profiles\nkac profile list\n\n# Switch active profile (will be used by default)\nkac profile switch prod\n\n# Now commands automatically use the 'prod' profile\nkac get topics\n\n# Override with a specific profile for a single command\nkac --profile dev get topics\n\n# Logout (remove stored credentials)\nkac logout\nkac logout --profile prod\n```\n\n**Security Features:**\n- Credentials are encrypted by your OS (macOS Keychain, Linux Secret Service, Windows Credential Manager)\n- No plaintext passwords in files or command history\n- Supports multiple profiles for different environments\n- Active profile is automatically used when `--profile` flag is not specified\n\n### Security Options (Alternative Methods)\n```bash\n# Using password prompt (good for one-time commands)\nkac --brokers kafka1:9092 --username alice --prompt-password get topics\n\n# Using password from stdin (good for automation)\necho \"mysecret\" | kac --brokers kafka1:9092 --username alice --prompt-password get topics\n\n# Using password flag (not recommended - visible in process list)\nkac --brokers kafka1:9092 --username alice --password secret get topics\n\n# Using custom CA certificate\nkac --brokers kafka1:9092 --username alice --prompt-password \\\n    --ca-cert /path/to/ca.crt get topics\n\n# Using self-signed certificates\nkac --brokers kafka1:9092 --username alice --prompt-password --insecure get topics\n```\n\n### Credential Priority Order\nWhen using stored credentials, the following priority order applies:\n1. Command-line flags (`--brokers`, `--username`, `--password`)\n2. Active profile (set via `kac profile switch`)\n3. Default profile (if `--profile` flag is not specified)\n4. Interactive prompt (if `--prompt-password` is used)\n\n## Command Reference\n\n### Commands\n\n#### Login / Logout / Profile Management\n\n```bash\n# Login and store credentials\nkac login --brokers kafka1:9092 --username alice\nkac login --profile prod --brokers kafka1:9092 --username alice --sasl-mechanism PLAIN\n\n# List all stored profiles\nkac profile list\n\n# Switch to a different profile (becomes the default)\nkac profile switch prod\n\n# Logout and remove credentials\nkac logout\nkac logout --profile prod\n```\n\n**Login Options:**\n- `--profile`: Profile name to store credentials under (default: \"default\")\n- All global connection flags can be used and will be stored\n\n**Profile List:**\n- Shows all stored profiles with their connection details\n- Indicates which profile is currently active with an asterisk (*)\n\n**Profile Switch:**\n- Sets the active profile that will be used by default for all commands\n- The active profile is stored in `~/.kac/active_profile`\n\n**Logout Options:**\n- `--profile`: Profile name to remove (default: \"default\")\n\n#### Version\n```bash\n# Display version information\nkac version\n```\nShows detailed version information including:\n- Version number\n- Git commit hash\n- Build date\n- Go version\n- OS/Architecture\n\n### Global Flags\n- `--profile`: Profile name to use for stored credentials (default: \"default\")\n- `--brokers, -b`: Kafka broker list (comma-separated)\n- `--username, -u`: SASL username\n- `--password, -w`: SASL password (use -P to prompt for password)\n- `--prompt-password, -P`: Prompt for password or read from stdin\n- `--ca-cert`: CA certificate file path\n- `--sasl-mechanism`: Authentication mechanism (SCRAM-SHA-512 or PLAIN)\n- `--insecure`: Skip TLS certificate verification\n\n### Topic Commands\n\n```bash\n# Create topic\nkac create topic mytopic --partitions 6 --replication-factor 3\n\n# List all topics\nkac get topics\n\n# Get specific topic details\nkac get topic mytopic\n\n# Delete topic\nkac delete topic mytopic\n\n# Modify topic configuration\nkac modify topic mytopic --config retention.ms=86400000\n\n# Export a single topic as Strimzi KafkaTopic YAML\nkac get topic mytopic -o strimzi\n\n# Export all topics as Strimzi KafkaTopic YAML (multi-document)\nkac get topics -o strimzi\n\n# Pipe to kubectl\nkac get topic mytopic -o strimzi | kubectl apply -f -\n```\n\n### ACL Commands\n\n```bash\n# Create ACL\nkac create acl \\\n  --resource-type TOPIC \\\n  --resource-name mytopic \\\n  --principal User:alice \\\n  --host \"*\" \\\n  --operation READ \\\n  --permission ALLOW\n\n# List all ACL principals\nkac get acls\n\n# Get ACL details (all filters are optional)\nkac get acl --principal User:alice\nkac get acl --resource-type TOPIC --resource-name mytopic\nkac get acl --resource-type TOPIC --resource-name mytopic --principal User:alice\n\n# Delete ACL\nkac delete acl \\\n  --resource-type TOPIC \\\n  --resource-name mytopic \\\n  --principal User:alice \\\n  --operation READ \\\n  --permission ALLOW\n\n# Modify ACL\nkac modify acl \\\n  --resource-type TOPIC \\\n  --resource-name mytopic \\\n  --principal User:alice \\\n  --operation READ \\\n  --permission ALLOW \\\n  --new-permission DENY\n\n# Export ACLs as Strimzi KafkaUser YAML (one document per principal)\nkac get acl --principal User:alice -o strimzi\nkac get acls -o strimzi\n\n# Pipe to kubectl\nkac get acl --principal User:alice -o strimzi | kubectl apply -f -\n```\n\n**Output format flag (`-o, --output`):**\n- `table` (default): human-readable text\n- `strimzi`: Strimzi `KafkaUser` CRD YAML with `spec.authorization.acls`.\n  Operations sharing the same resource, host, and permission are merged.\n  The default `type: allow` is omitted since it is the Strimzi default.\n\n### Consumer Group Commands\n\n```bash\n# List all consumer groups\nkac get consumergroups\n\n# Get specific group details\nkac get consumergroup my-group-id\n\n# Set consumer group offsets\nkac set-offsets consumergroup my-group-id my-topic 0 1000\n\n# Delete consumer group\nkac delete consumergroup my-group-id\n```\n\n## Build Information\n\nThe build script (`build.sh`) provides:\n- Version information from git tags\n- CGO disabled for better portability\n- Stripped debug information for smaller binary size\n- Dependency management with `go mod tidy`\n\n## License\n\nThis project is licensed under the Apache License 2.0 - see the [LICENSE](LICENSE) file for details.\n\n## Credits\n\nCopyright 2024-2026 Jan Harald Fonås\n\nCreated by Jan Harald Fonås with the assistance of an LLM.\n\n### Built Using\n- [franz-go](https://github.com/twmb/franz-go) - A feature-complete, pure Go Kafka client (Apache-2.0)\n- [cobra](https://github.com/spf13/cobra) - A library for creating powerful modern CLI applications (Apache-2.0)\n- [kcat](https://github.com/edenhill/kcat) - Inspiration for the CLI design and functionality\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjanfonas%2Fkafka-admin-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjanfonas%2Fkafka-admin-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjanfonas%2Fkafka-admin-cli/lists"}