Skip to content

Kafka on OpenShift with Strimzi

You don’t install Kafka on OpenShift so much as declare it and let an operator run it. Two builds of the same operator exist: the open-source Strimzi operator, and Red Hat’s supported build, Streams for Apache Kafka (formerly AMQ Streams). Functionally the same; the Red Hat build adds the support story.

Watch on YouTube ↗
  1. Create a namespace for Kafka (e.g. kafka). You’ll need cluster-admin or strimzi-admin rights to install the operator.

  2. Install the operator from OperatorHub — Operators → OperatorHub, search for Streams for Apache Kafka (or Strimzi) in the Streaming & Messaging category, pick a channel, install. This deploys the Cluster Operator, the CRDs, and RBAC. Confirm it shows Succeeded under Installed Operators.

  3. Declare a Kafka cluster by applying a Kafka custom resource. The operator reconciles it into running brokers/controllers, services and config.

apiVersion: kafka.strimzi.io/v1beta2
kind: Kafka
metadata:
name: my-cluster
namespace: kafka
spec:
kafka:
replicas: 3
listeners:
- name: plain
port: 9092
type: internal
tls: false
storage:
type: persistent-claim
size: 100Gi

Kafka has moved off ZooKeeper to KRaft, where Kafka manages its own metadata quorum. On Strimzi this comes with KafkaNodePool resources: instead of one undifferentiated set of brokers, you define pools of nodes and assign them broker and/or controller roles.

apiVersion: kafka.strimzi.io/v1beta2
kind: KafkaNodePool
metadata:
name: brokers
namespace: kafka
labels:
strimzi.io/cluster: my-cluster
spec:
replicas: 3
roles:
- broker
storage:
type: persistent-claim
size: 100Gi

You can install via OperatorHub/OLM (easiest, automatic updates) or apply the raw installation artifacts with oc apply -f ./install/cluster-operator for more control.

Strimzi manages the cluster — brokers, topics, rebalancing (via Cruise Control). It does not scale the applications reading from Kafka. Scaling your consumers to keep up with load is a separate concern, and the right tool for it is KEDA — the next guide.