Module: KAFKA
Kafka is a distributed event-streaming platform. Pigsty’s KAFKA module installs Apache Kafka 4.1+ dynamic KRaft clusters on managed nodes from RPM/DEB packages. It manages security, resources, lifecycle, and observability.
Kafka is a Beta module. Before production use, test it thoroughly and verify that it meets your requirements. Test dynamic KRaft, strict rolling restarts, TLS/SCRAM/ACL, declared topics and users, credential and certificate rotation, and the complete monitoring pipeline.
Module Capabilities
The KAFKA module currently provides:
- Native dynamic KRaft, without ZooKeeper or static
controller.quorum.voters. - Native roles
combined,broker, andcontroller, with combined or separate control and data planes. - Random Cluster ID and Controller Directory IDs for new clusters. A minimal bootstrap manifest freezes these values and blocks conflicting operations.
- Lifecycle selection from live health: cold start or repair, serial broker admission, dynamic controller join, or strict single-node rolling restart.
- Checks before and after each rolling step: controller majority, voter catch-up, offline partitions, under-min-ISR, and ISR catch-up.
- Member retirement and failed-node replacement through playbooks.
kafka-rm.ymlretires a strict subset, including dead nodes. Node replacement uses three commands. plaintextand productionscramprofiles. The latter provides TLS, SCRAM-SHA-512, controller mTLS, ACLs, and default-deny authorization.- Declarative topics, credentials, ACLs, and quotas without implicit deletion. Protected internal credential and certificate rotation.
- JMX and protocol exporters, 19 recording rules, 15 alert rules, four Grafana dashboards, and VictoriaLogs storage.
Module Architecture
NODE provides node management, package repositories, and base monitoring. INFRA provides VictoriaMetrics, VictoriaLogs, Grafana, and Alertmanager. KAFKA depends on both.
Every Kafka JVM includes JMX Exporter and registers as job=kafka. kafka_exporter runs on the first two broker-capable nodes, ordered by kafka_seq. A single broker runs one exporter; pure controllers run none. Both exporters report the same logical cluster. Recording rules deduplicate their metrics before aggregation.
Documentation
| Document | Contents |
|---|---|
| Quickstart | From a single node to a three-node secure cluster: client access, parameter changes, and go-live checks |
| Cluster Config | Topology, dynamic KRaft, network, storage, security, and resource declarations |
| Parameters | 15 persistent public parameters plus transient operational variables |
| Administration | Status checks, topics, messages, consumer groups, and topology changes |
| Playbook | kafka.yml lifecycle, task tags, rotation, and teardown safeguards |
| Monitoring | Metrics pipeline, dashboards, log queries, and alert rules |
| Metrics | Metric dictionary for JMX, the protocol exporter, and recording rules |
| FAQ | Questions on roles, identity, security, exporters, and scaling |
First Time
Follow Quickstart to build a single-node development cluster, then a three-node TLS/SCRAM/ACL cluster. Continue with client access, parameter and resource changes, and deployment checks.
If you know Kafka and Pigsty, start with Cluster Config or Parameters.
Default Ports
| Port | Service | Deployment scope | plaintext | scram |
|---|---|---|---|---|
9092 | Kafka Broker | Broker-capable nodes | PLAINTEXT | SASL_SSL + SCRAM-SHA-512 |
9093 | KRaft Controller | Controller-capable nodes | PLAINTEXT | Mutual TLS |
9308 | kafka_exporter | Up to two broker-capable nodes | HTTP metrics | HTTP metrics, TLS/SCRAM on the backend |
9404 | JMX Exporter | All Kafka nodes | HTTP metrics | HTTP metrics |
All four ports must be different. Parameters can change each port. Restrict JMX and protocol exporter HTTP ports to the monitoring network through firewalls.
Current Boundaries
This role provides a core Kafka deployment baseline. A complete streaming platform or managed service requires additional components or procedures for:
- Existing partition reassignment and replica balancing after expansion. Playbooks manage member join, retirement, and replacement, but data movement needs an explicit plan.
- Increasing the frozen
default.replication.factorafter expansion. Kafka 4.3 requires explicit data migration and a static-configuration maintenance window. - Changing existing topic replication factors, deleting topics, and deleting users.
- Migrating formatted clusters online from
plaintexttoscram. - Kafka upgrades, feature-level finalization, backup, restore, and disaster exercises.
- Multiple listeners, NAT or public addresses, multiple client networks per broker, and tiered storage.
- Kafka Connect, Schema Registry, MirrorMaker 2, Cruise Control, and web interfaces.
Document these limits in production plans, approval processes, and exercises. Running the ordinary inventory again does not perform these operations.
Deploy single-node and 3-node Kafka clusters from scratch, with secure access, parameter tuning, and launch checklist.
Plan Kafka dynamic KRaft topology, identity, network, storage, security, and declarative resources.
15 persistent public parameters and transient protected operational variables of the KAFKA module.
Kafka status checks, topic and user management, config changes, scaling, failed-node replacement, and security rotation.
Run dynamic KRaft lifecycle, strict rolling, resource convergence, rotation, and removal with kafka.yml and kafka-rm.yml.
Kafka metrics collection, Grafana dashboards, log queries, and alerting rules.
Kafka JMX, protocol exporter, and recording rule metrics dictionary.
Frequently asked questions about the Pigsty Kafka 4.1+ dynamic KRaft module.
Was this page helpful?
Thanks—your feedback helps us improve this page.
What got in the way? (optional)