Skip to content

Module: KAFKA

Deploy, secure, and monitor Apache Kafka 4.1+ dynamic KRaft clusters with Pigsty.

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.

Current status: Beta module

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, and controller, 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.yml retires a strict subset, including dead nodes. Node replacement uses three commands.
  • plaintext and production scram profiles. 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

DocumentContents
QuickstartFrom a single node to a three-node secure cluster: client access, parameter changes, and go-live checks
Cluster ConfigTopology, dynamic KRaft, network, storage, security, and resource declarations
Parameters15 persistent public parameters plus transient operational variables
AdministrationStatus checks, topics, messages, consumer groups, and topology changes
Playbookkafka.yml lifecycle, task tags, rotation, and teardown safeguards
MonitoringMetrics pipeline, dashboards, log queries, and alert rules
MetricsMetric dictionary for JMX, the protocol exporter, and recording rules
FAQQuestions 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

PortServiceDeployment scopeplaintextscram
9092Kafka BrokerBroker-capable nodesPLAINTEXTSASL_SSL + SCRAM-SHA-512
9093KRaft ControllerController-capable nodesPLAINTEXTMutual TLS
9308kafka_exporterUp to two broker-capable nodesHTTP metricsHTTP metrics, TLS/SCRAM on the backend
9404JMX ExporterAll Kafka nodesHTTP metricsHTTP 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.factor after 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 plaintext to scram.
  • 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?