Skip to main content
Version: 3.0.0-alpha (Diátaxis)

Concepts — Kafka

Architecture

Kafka on Hikube is a managed distributed streaming service. Each instance deployed via the Kafka resource creates a cluster of brokers coordinated by ZooKeeper, capable of handling millions of messages per second with guaranteed persistence.


Terminology

TermDescription
KafkaKubernetes resource (apps.cozystack.io/v1alpha1) representing a managed Kafka cluster.
BrokerKafka instance that stores messages and serves producers/consumers.
ZooKeeperDistributed coordination service that manages cluster metadata, leader election, and topic configuration.
TopicNamed message channel. Producers write to a topic, consumers read from a topic.
PartitionSubdivision of a topic. Each partition is an ordered log of messages, distributed on a broker.
Replication FactorNumber of copies of each partition across different brokers.
Consumer GroupGroup of consumers that share the partitions of a topic for parallel processing.
RetentionMaximum duration or size for message retention in a topic.
resourcesPresetPredefined resource profile (nano to 2xlarge).

Topics and partitions

How it works

A topic is divided into partitions, each distributed on a different broker:

  • More partitions = more parallelism
  • Each partition has a leader (a broker) and followers (replicas)
  • The replicationFactor determines the number of copies of each partition

Topic configuration

Topics are declared directly in the Kafka manifest:

ParameterDescription
topics[name].partitionsNumber of partitions for the topic
topics[name].config.replicationFactorNumber of replicas per partition
topics[name].config.retentionMsRetention duration in ms (e.g., 604800000 = 7 days)
topics[name].config.cleanupPolicydelete (deletion by TTL) or compact (keep the last message per key)

ZooKeeper

ZooKeeper handles Kafka cluster coordination:

  • Leader election for each partition
  • Metadata storage (topics, partitions, offsets)
  • Failure detection of brokers
tip

Always configure an odd number of ZooKeeper instances (zookeeper.replicas: 3) to guarantee quorum.

ZooKeeper resources are configured independently from brokers via zookeeper.resources or zookeeper.resourcesPreset.


Resource presets

Presets apply separately to Kafka brokers and ZooKeeper:

PresetCPUMemory
nano250m128Mi
micro500m256Mi
small1512Mi
medium11Gi
large22Gi
xlarge44Gi
2xlarge88Gi

Limits and quotas

ParameterValue
Max Kafka brokersDepending on tenant quota
ZooKeeper instances3 recommended (odd number)
Topics per clusterUnlimited (depending on resources)
Partitions per topicConfigurable
Storage sizeVariable (kafka.size, zookeeper.size)

Further reading