Kafka on OpenShift in 15 Minutes: From Zero to Cluster with Red Hat Streams for Apache Kafka
A hands-on guide to deploying a production-ready Kafka cluster on OpenShift using the Strimzi operator

You need a Kafka cluster on OpenShift. Apache Kafka's documentation has dozens of pages on broker configuration, startup scripts, and environment variables. Before producing your first message, two hours have passed adjusting JVM heap, persistent volumes, and network permissions.
Kafka is not hard to operate — but configuring it manually on Kubernetes is. What if an operator could turn all that complexity into a single declarative YAML file?
That is exactly what Red Hat Streams for Apache Kafka does.
This article is a hands-on guide: in 15 minutes you will have a working Kafka cluster on OpenShift, managed like any other Kubernetes resource — through Custom Resources that can be versioned in Git.
If you have read Kafka for High Availability in Practice, you already know why replication factor,
min.insync.replicas, and rack awareness matter. Today we take the first step: getting the cluster up and running.
What is Red Hat Streams for Apache Kafka
Red Hat Streams for Apache Kafka is Red Hat's supported distribution for running Apache Kafka on OpenShift. Based on the open source project Strimzi, Streams provides enterprise support, native integration with the OpenShift ecosystem, and lifecycle management through the Operator Lifecycle Manager (OLM).
The current version (3.2) runs exclusively in KRaft mode — Kafka's native Raft protocol that replaces ZooKeeper for metadata management. This eliminates the external dependency and simplifies the architecture: fewer components to manage, fewer failure points.
Streams for Apache Kafka Custom Resources
The operator manages everything through CRs (Custom Resources). The main ones:
Kafka— The Kafka cluster: listeners, version, global configKafkaNodePool— Node pools: roles (broker, controller, or both), storage, replicasKafkaTopic— Topics: partitions, replication factor, settingsKafkaUser— Users and permissions: authentication and ACLsKafkaConnect— Connectors for external system integrationKafkaMirrorMaker2— Cross-cluster replication (disaster recovery)
Step 1 — Install the operator via OperatorHub
In the OpenShift console:
- Navigate to Home → Projects and create a project for the installation (for example,
streams-kafka) - Navigate to Operators → OperatorHub
- Search for Streams for Apache Kafka
- Select the operator and click Install
- Choose the
stableupdate channel and the project created in step 1 - Click Install
The operator deploys the Cluster Operator, CRDs, and RBAC resources automatically. When the status changes to Succeeded, the operator is ready.
To confirm via CLI:
oc get pods -n streams-kafka
NAME READY STATUS RESTARTS AGE
amq-streams-cluster-operator-v3.2.0-xxxxx-xxxxx 1/1 Running 0 45s
Step 2 — Create the Kafka cluster
With the operator running, the next step is creating the cluster. In Streams for Apache Kafka 3.2, you define the cluster with two types of Custom Resources: Kafka (global cluster configuration) and KafkaNodePool (node pools with specific roles).
Create the Kafka resource
apiVersion: kafka.strimzi.io/v1
kind: Kafka
metadata:
name: my-cluster
namespace: streams-kafka
spec:
kafka:
version: 4.2.0
metadataVersion: "4.2"
listeners:
- name: plain
port: 9092
type: internal
tls: false
- name: tls
port: 9093
type: internal
tls: true
config:
offsets.topic.replication.factor: 3
transaction.state.log.replication.factor: 3
transaction.state.log.min.isr: 2
default.replication.factor: 3
min.insync.replicas: 2
entityOperator:
topicOperator: {}
userOperator: {}
oc apply -f kafka-cluster.yaml -n streams-kafka
Create the broker pool
apiVersion: kafka.strimzi.io/v1
kind: KafkaNodePool
metadata:
name: broker
namespace: streams-kafka
labels:
strimzi.io/cluster: my-cluster
spec:
replicas: 3
roles:
- broker
storage:
type: jbod
volumes:
- id: 0
type: persistent-claim
size: 10Gi
deleteClaim: false
oc apply -f broker-pool.yaml -n streams-kafka
Create the controller pool
apiVersion: kafka.strimzi.io/v1
kind: KafkaNodePool
metadata:
name: controller
namespace: streams-kafka
labels:
strimzi.io/cluster: my-cluster
spec:
replicas: 3
roles:
- controller
storage:
type: jbod
volumes:
- id: 0
type: persistent-claim
size: 5Gi
deleteClaim: false
kraftMetadata: shared
oc apply -f controller-pool.yaml -n streams-kafka
What these YAMLs do
Kafka my-cluster:
- Uses Apache Kafka 4.2.0 with metadataVersion 4.2 (native KRaft — no ZooKeeper)
- Defines two listeners:
plain(port 9092, no TLS) for development andtls(port 9093) for secure communication - Sets replication factor 3 and
min.insync.replicas: 2as defaults — the minimum for fault tolerance - Includes the
entityOperatorwithtopicOperatoranduserOperator, which allow managing topics and users through CRs
KafkaNodePool broker:
- Creates 3 nodes dedicated to the broker role — message storage and serving
- Each node gets a 10Gi persistent volume
KafkaNodePool controller:
- Creates 3 nodes dedicated to the controller role — KRaft metadata management
- 5Gi persistent volume with
kraftMetadata: shared
Monitor the cluster creation
oc get kafka my-cluster -n streams-kafka -w
When the READY column shows True, the cluster is ready. In a typical environment, this takes 2 to 5 minutes.
Verify the pods:
oc get pods -n streams-kafka
NAME READY STATUS RESTARTS AGE
my-cluster-broker-0 1/1 Running 0 3m
my-cluster-broker-1 1/1 Running 0 3m
my-cluster-broker-2 1/1 Running 0 3m
my-cluster-controller-3 1/1 Running 0 3m
my-cluster-controller-4 1/1 Running 0 3m
my-cluster-controller-5 1/1 Running 0 3m
my-cluster-entity-operator-xxxxx-xxxxx 2/2 Running 0 2m
amq-streams-cluster-operator-v3.2.0-xxxxx-xxxxx 1/1 Running 0 8m
Step 3 — Create a topic
With the Topic Operator running (part of the Entity Operator), topics are managed through Custom Resources:
apiVersion: kafka.strimzi.io/v1
kind: KafkaTopic
metadata:
name: orders
namespace: streams-kafka
labels:
strimzi.io/cluster: my-cluster
spec:
partitions: 6
replicas: 3
config:
retention.ms: 604800000
segment.bytes: 1073741824
oc apply -f topic-orders.yaml -n streams-kafka
The orders topic will be created with 6 partitions, replication factor 3, and 7-day retention. Verify:
oc get kafkatopic orders -n streams-kafka
NAME CLUSTER PARTITIONS REPLICATION FACTOR READY
orders my-cluster 6 3 True
Why manage topics through CRs
- Versionable in Git — configuration changes are tracked in repository history
- Auditable — who created it, when it was changed, what was modified
- Consistent — same configuration across all environments (dev, staging, production)
- Drift protection — the Topic Operator continuously reconciles; manual CLI changes are overwritten
Step 4 — Produce and consume messages
With the cluster and topic ready, let's produce and consume test messages using the official Streams for Apache Kafka container image.
Produce messages
oc run kafka-producer -ti \
--image=registry.redhat.io/amq-streams/kafka-42-rhel9:3.2.0 \
--rm=true --restart=Never -n streams-kafka \
-- bin/kafka-console-producer.sh \
--bootstrap-server my-cluster-kafka-bootstrap:9092 \
--topic orders
Type a few messages and press Ctrl+C to exit:
>{"orderId": "001", "product": "keyboard", "quantity": 2}
>{"orderId": "002", "product": "monitor", "quantity": 1}
>{"orderId": "003", "product": "mouse", "quantity": 5}
Consume messages
In another terminal:
oc run kafka-consumer -ti \
--image=registry.redhat.io/amq-streams/kafka-42-rhel9:3.2.0 \
--rm=true --restart=Never -n streams-kafka \
-- bin/kafka-console-consumer.sh \
--bootstrap-server my-cluster-kafka-bootstrap:9092 \
--topic orders \
--from-beginning
{"orderId": "001", "product": "keyboard", "quantity": 2}
{"orderId": "002", "product": "monitor", "quantity": 1}
{"orderId": "003", "product": "mouse", "quantity": 5}
All three messages appear in the consumer — confirming the cluster is working end to end.
Step 5 — Expose the cluster to external applications
By default, internal listeners are only accessible from within the OpenShift cluster. For external applications, add a listener of type route:
listeners:
- name: plain
port: 9092
type: internal
tls: false
- name: tls
port: 9093
type: internal
tls: true
- name: external
port: 9094
type: route
tls: true
Streams for Apache Kafka automatically creates the Routes in OpenShift. External clients connect on port 443 (the default OpenShift Router port), and traffic is forwarded to the configured listener port 9094.
To retrieve the bootstrap address:
oc get routes my-cluster-kafka-external-bootstrap -n streams-kafka \
-o jsonpath='{.status.ingress[0].host}'
External clients need the cluster's CA certificate to establish the TLS connection:
oc extract secret/my-cluster-cluster-ca-cert -n streams-kafka \
--keys=ca.crt --to=- > ca.crt
Step 6 — What to do next
With the cluster running, next steps depend on the scenario:
For production:
- Configure rack awareness to distribute replicas across availability zones
- Enable SCRAM-SHA-512 or mTLS authentication via
KafkaUser - Set up monitoring with Kafka Exporter and Prometheus
- Define resource requests and limits in
KafkaNodePool
For high availability and disaster recovery:
- Configure MirrorMaker 2 for cross-cluster replication
- Use Cruise Control for automatic partition rebalancing
- Plan and test failover using chaos engineering tools
For a detailed guide on high availability patterns with Red Hat Streams, see the companion article: Kafka for High Availability in Practice: Patterns with Red Hat Streams for Apache Kafka.
Closing thoughts
Red Hat Streams for Apache Kafka turns Kafka management on OpenShift from an operational problem into a declarative one. Instead of provisioning scripts and manual configuration, you define the desired state in CRs — and the operator handles the rest.
In 15 minutes, we covered: installing the operator via OperatorHub, creating a 6-node Kafka cluster (3 brokers + 3 controllers) in KRaft mode, managing topics through Custom Resources, and producing/consuming test messages. Everything declarative, versionable in Git, and auditable.
The cluster we built here is a starting point. For production environments, high availability patterns — replication, rack awareness, monitoring, and disaster recovery — are what separates a working cluster from a reliable one.
Resources
Comments
Join the discussionNo comments yet. Be the first to comment.



