# Stackable Operator for Apache Kafka

> Deploy and manage Apache Kafka clusters on Kubernetes using Stackable Operator.

-   [GitHub](https://github.com/stackabletech/kafka-operator/)

-   [Feature Tracker](https://features.stackable.tech/unified)

-   [CRD documentation](https://crds.stackable.tech/kafka-operator/26.7.0/)


The Stackable operator for Apache Kafka is an operator that can deploy and manage [Apache Kafka](https://kafka.apache.org/) clusters on Kubernetes. Apache Kafka is a distributed streaming platform designed to handle large volumes of data in real-time. It is commonly used for real-time data processing, data ingestion, event streaming, and messaging between applications.

## Getting started

Follow the [Getting started](https://docs.stackable.tech/home/stable/kafka/getting_started/index.md) which guides you through installing The Stackable Kafka and ZooKeeper operators, setting up ZooKeeper and Kafka and testing your Kafka installation.

## Resources

The _KafkaCluster_ custom resource contains your Kafka cluster configuration. It defines a single `broker` [role](https://docs.stackable.tech/home/stable/concepts/stacklet/index.md).

![A diagram depicting the Kubernetes resources created by the operator](https://docs.stackable.tech/home/stable/kafka/_images/kafka_overview.drawio.svg)

For every [role group](https://docs.stackable.tech/home/stable/concepts/stacklet/index.md) in the `broker` role the operator creates a StatefulSet. Multiple Services are created - one at role level, one per role group as well as one for every individual Pod - to allow access to the entire Kafka cluster, parts of it or just individual brokers.

For every StatefulSet, a ConfigMap is deployed containing [logging](https://docs.stackable.tech/home/stable/kafka/usage-guide/logging/index.md) properties and a Kafka configuration file which is derived from the KafkaCluster resource.

The operator creates a [Service discovery ConfigMap](https://docs.stackable.tech/home/stable/concepts/service-discovery/index.md) for the whole KafkaCluster which references the Service for the whole cluster. Other operators use this ConfigMap to connect to a Kafka cluster simply by name and it can also be used by custom third party applications to find the connection endpoint.

## Dependencies

Kafka requires [Apache ZooKeeper](https://docs.stackable.tech/home/stable/zookeeper/index.md) for coordination purposes (it will not be needed in the future as it will be replaced with a [built-in solution](https://cwiki.apache.org/confluence/display/KAFKA/KIP-500%3A+Replace+ZooKeeper+with+a+Self-Managed+Metadata+Quorum)).

## Connections to other products

Since Kafka often takes on a bridging role, many other products connect to it. In the [demos](https://docs.stackable.tech/home/stable/kafka/index.md) below you find example data pipelines that use [Apache NiFi with the Stackable operator](https://docs.stackable.tech/home/stable/nifi/index.md) to write to Kafka and [Apache Druid with the Stackable operator](https://docs.stackable.tech/home/stable/nifi/index.md) to read from Kafka. But you can also connect using [Apache Spark](https://docs.stackable.tech/home/stable/spark-k8s/index.md) or with a custom Job written in various languages.

## Demos

[stackablectl](https://docs.stackable.tech/management/stable/stackablectl/index.md) supports installing [Demos](https://docs.stackable.tech/home/stable/demos/index.md) with a single command. The demos are complete data piplines which showcase multiple components of the Stackable platform working together and which you can try out interactively. Both demos below inject data into Kafka using NiFi and read from the Kafka topics using Druid.

### Waterlevel demo

The [nifi-kafka-druid-water-level-data](https://docs.stackable.tech/home/stable/demos/nifi-kafka-druid-water-level-data/index.md) demo uses data from [PEGELONLINE](https://www.pegelonline.wsv.de/webservice/ueberblick) to visualize water levels in rivers and coastal regions of Germany from historic and real time data.

### Earthquake demo

The [nifi-kafka-druid-earthquake-data](https://docs.stackable.tech/home/stable/demos/nifi-kafka-druid-earthquake-data/index.md) demo ingests [earthquake data](https://earthquake.usgs.gov/) into a similar pipeline as is used in the waterlevel demo.

## Supported versions

The Stackable operator for Apache Kafka currently supports the Kafka versions listed below. To use a specific Kafka version in your KafkaCluster, you have to specify an image - this is explained in the [Product image selection](https://docs.stackable.tech/home/stable/concepts/product-image-selection/index.md) documentation. The operator also supports running images from a custom registry or running entirely customized images; both of these cases are explained under [Product image selection](https://docs.stackable.tech/home/stable/concepts/product-image-selection/index.md) as well.

-   4.2.1 (experimental, deprecated) - Requires KRaft, please read on the [Kraft migration guide](https://docs.stackable.tech/home/stable/kafka/usage-guide/kraft-controller/index.md).

-   4.1.1 (experimental, deprecated) - Requires KRaft, please read on the [Kraft migration guide](https://docs.stackable.tech/home/stable/kafka/usage-guide/kraft-controller/index.md).

-   3.9.2 (LTS)

-   3.9.1 (deprecated)


Support for clusters running in Kraft mode (which includes Apache Kafka 4.x.x) is experimental because it has not been thoroughly tested in production environments yet.

Also there are some known issues such as:

-   Controller scaling is not reliable.

-   Kerberos authentication is not tested yet.

-   Service exposition is not definitive.


## Useful links

-   The [kafka-operator](https://github.com/stackabletech/kafka-operator/) GitHub repository

-   The operator feature overview in the [feature tracker](https://features.stackable.tech/unified)

-   The [KafkaCluster](https://crds.stackable.tech/26.7.0/kafka.stackable.tech/kafkacluster/v1alpha1/) CRD documentation
