@@ -19,249 +19,26 @@ Kafka uses a **publish-subscribe** model organized around the following core con
1919 each partition assigned to exactly one member.
2020
2121Running Kafka on [ NERC OpenShift] ( https://nerc-project.github.io/nerc-docs/openshift/ )
22- is the recommended approach for course workloads requiring persistent, scalable message
23- streaming. This guide uses the ** [ Strimzi Operator] ( https://strimzi.io/ ) ** ,
24- which is the standard Kubernetes-native method for deploying Kafka on OpenShift
25- on NERC.
22+ is accomplished using the ** [ Strimzi Operator] ( https://strimzi.io/ ) ** ,
23+ which is the standard Kubernetes-native method for deploying Kafka on OpenShift.
2624
2725## Prerequisites
2826
29- Before proceeding, ensure you have :
27+ For this guide, you will need :
3028
31- - Access to a [ NERC OpenShift project] ( https://nerc-project.github.io/nerc-docs/openshift/logging-in/access-the-openshift-web-console/ )
32- - The ` oc ` CLI installed and authenticated to the NERC OpenShift cluster
33- - Sufficient quota in your project (at least 3 vCPUs and 6 GiB memory recommended
34- for a minimal Kafka cluster)
29+ - Access to a NERC OpenShift project with Kafka already deployed
30+ (provided by your instructor)
31+ - The bootstrap server address and CA certificate credentials
32+ (provided by your instructor)
33+ - Your ` TEAM_ID ` (for authentication to the Kafka broker)
34+ - The ` oc ` CLI installed (optional, only if you want to inspect the cluster status)
3535
36- !!! note "Checking Your Quota "
36+ !!! note "Kafka Infrastructure is Pre-Deployed "
3737
38- You can view your project's resource quota by running:
39-
40- ```sh
41- oc describe quota -n <your-project>
42- ```
43-
44- If you need additional resources, contact your project PI or NERC support.
45-
46- ## Deploy Kafka Using the Strimzi Operator
47-
48- Strimzi provides a Kubernetes Operator that manages the full lifecycle of Kafka
49- clusters on OpenShift. On NERC OpenShift, you will install Strimzi into your own
50- namespace.
51-
52- ### Install the Strimzi Operator
53-
54- - Log in to the NERC OpenShift cluster and switch to your project namespace:
55-
56- ``` sh
57- oc login < your-openshift-api-url>
58- oc project < your-project>
59- ```
60-
61- For example:
62-
63- ` ` ` sh
64- oc login https://api.edu.nerc.mghpcc.org:6443
65- oc project ds551-2026-spring-9ab13b
66- ` ` `
67-
68- - Download the Strimzi installation YAML files. Always check the
69- [Strimzi releases page](https://github.com/strimzi/strimzi-kafka-operator/releases)
70- for the latest version:
71-
72- ` ` ` sh
73- STRIMZI_VERSION=" 0.50.1"
74- wget https://github.com/strimzi/strimzi-kafka-operator/releases/download/${STRIMZI_VERSION} /strimzi-${STRIMZI_VERSION} .tar.gz
75- tar -xzf strimzi-${STRIMZI_VERSION} .tar.gz
76- cd strimzi-${STRIMZI_VERSION}
77- ` ` `
78-
79- !!! warning " Very Important Note"
80-
81- Check the [Strimzi compatibility matrix](https://strimzi.io/downloads/) to
82- confirm the Strimzi version supports the Kafka version and Kubernetes/OpenShift
83- version running on NERC. Mismatched versions can prevent the operator from
84- starting. For Kafka 4.0+, use Strimzi 0.50.0 or later.
85-
86- - Update the installation files to use your project namespace. Replace all
87- occurrences of ` myproject` with your actual namespace:
88-
89- ` ` ` sh
90- sed -i ' ' ' s/namespace: .*/namespace: <your-project>/' install/cluster-operator/* RoleBinding* .yaml
91- ` ` `
92-
93- For example:
94-
95- ` ` ` sh
96- sed -i ' ' ' s/namespace: .*/namespace: ds551-2026-spring-9ab13b/' install/cluster-operator/* RoleBinding* .yaml
97- ` ` `
98-
99- !!! important " Make sure to update the namespace"
100-
101- The ` -n < your-project> ` flag explicitly specifies the namespace for all
102- subsequent ` oc` commands. Always include this flag when working with multiple
103- projects to avoid accidentally operating on the wrong namespace.
104-
105- - Apply the Strimzi Cluster Operator installation files:
106-
107- ` ` ` sh
108- oc apply -f install/cluster-operator/ -n < your-project>
109- ` ` `
110-
111- - Verify the operator pod is running:
112-
113- ` ` ` sh
114- oc get pods -n < your-project> -l name=strimzi-cluster-operator
115- ` ` `
116-
117- The output should look similar to:
118-
119- ` ` ` text
120- NAME READY STATUS RESTARTS AGE
121- strimzi-cluster-operator-7d96bf8c59-kfzwp 1/1 Running 0 45s
122- ` ` `
123-
124- !!! note " Note"
125-
126- It may take 1–2 minutes for the operator pod to reach ` Running` status.
127-
128- # ## Create a Kafka Cluster
129-
130- Once the Strimzi Operator is running, you can deploy a Kafka cluster by creating
131- a ` Kafka` custom resource and a ` KafkaNodePool` resource.
132-
133- !!! warning " Important: KafkaNodePool is Required"
134-
135- As of Kafka 4.0+, Strimzi uses ` KafkaNodePool` to define broker and controller nodes.
136- Both resources must be created together. The ` KafkaNodePool` should define at least
137- one node pool with both ` broker` and ` controller` roles for KRaft mode operation.
138- Without a KafkaNodePool, the Kafka cluster will not deploy.
139-
140- - Create a file named ` kafka-cluster.yaml` with the Kafka cluster definition:
141-
142- ` ` ` yaml
143- apiVersion: kafka.strimzi.io/v1
144- kind: KafkaNodePool
145- metadata:
146- name: dual-role
147- namespace: < your-project>
148- labels:
149- strimzi.io/cluster: my-cluster
150- spec:
151- replicas: 1
152- roles:
153- - broker
154- - controller
155- storage:
156- type: persistent-claim
157- size: 1Gi
158- ---
159- apiVersion: kafka.strimzi.io/v1beta2
160- kind: Kafka
161- metadata:
162- name: my-cluster
163- namespace: < your-project>
164- spec:
165- kafka:
166- version: 4.1.1
167- listeners:
168- - name: plain
169- port: 9092
170- type: internal
171- tls: false
172- - name: tls
173- port: 9093
174- type: internal
175- tls: true
176- config:
177- offsets.topic.replication.factor: 1
178- transaction.state.log.replication.factor: 1
179- transaction.state.log.min.isr: 1
180- default.replication.factor: 1
181- min.insync.replicas: 1
182- entityOperator:
183- topicOperator: {}
184- userOperator: {}
185- ` ` `
186-
187- !!! warning " Very Important Note"
188-
189- - Kafka 4.0+ requires ` KafkaNodePool` with both ` broker` and ` controller` roles
190- for KRaft (Kraft Raft) consensus mode operation.
191- - This configuration uses persistent storage (1Gi) suitable for testing and demo purposes.
192- For production or larger workloads, increase the ` size` value or use a specific ` storageClass` .
193- See the
194- [Strimzi storage documentation](https://strimzi.io/docs/operators/latest/full/deploying.html#type-PersistentClaimStorage-reference)
195- for details.
196- - Make sure the ` KafkaNodePool` metadata includes the label ` strimzi.io/cluster: my-cluster`
197- to link it to the Kafka resource.
198-
199- - Apply the Kafka cluster definition:
200-
201- ` ` ` sh
202- oc apply -f kafka-cluster.yaml -n < your-project>
203- ` ` `
204-
205- - Watch the cluster come up. It may take 3–5 minutes for all pods to reach
206- ` Running` status:
207-
208- ` ` ` sh
209- oc get pods -n < your-project> -l strimzi.io/cluster=my-cluster -w
210- ` ` `
211-
212- A healthy cluster will show output similar to:
213-
214- ` ` ` text
215- NAME READY STATUS RESTARTS AGE
216- my-cluster-dual-role-0 1/1 Running 0 3m
217- my-cluster-entity-operator-6d7f9c7d4b-xqtlp 2/2 Running 0 2m
218- ` ` `
219-
220- !!! note " Note about Kafka 4.0+ Differences"
221-
222- In Kafka 4.0+:
223- - There are ** no ZooKeeper pods** . The broker manages its own metadata using KRaft.
224- - Pod names follow the pattern ` < cluster-name> -< nodepool-name> -< id> ` .
225- - With this single-node setup using ` dual-role` , you' ll see pods named `my-cluster-dual-role-0`.
226-
227- ### Create a Kafka Topic
228-
229- - Create a file named `kafka-topic.yaml`:
230-
231- ```yaml
232- apiVersion: kafka.strimzi.io/v1beta2
233- kind: KafkaTopic
234- metadata:
235- name: my-topic
236- namespace: <your-project>
237- labels:
238- strimzi.io/cluster: my-cluster
239- spec:
240- partitions: 3
241- replicas: 1
242- config:
243- retention.ms: 7200000
244- segment.bytes: 1073741824
245- ```
246-
247- - Apply the topic:
248-
249- ```sh
250- oc apply -f kafka-topic.yaml -n <your-project>
251- ```
252-
253- - Verify the topic was created:
254-
255- ```sh
256- oc get kafkatopic my-topic -n <your-project>
257- ```
258-
259- Expected output:
260-
261- ```text
262- NAME CLUSTER PARTITIONS REPLICATION FACTOR READY
263- my-topic my-cluster 3 1 True
264- ```
38+ The Strimzi Operator and Kafka cluster have already been deployed by your instructor
39+ or course staff. You do **not** need to install the operator or create a Kafka cluster
40+ yourself. You only need to connect to the shared Kafka broker using the provided
41+ credentials.
26542
26643## Test the Kafka Cluster
26744
@@ -392,28 +169,4 @@ for msg in consumer:
392169 project namespace. If you need external access, configure a ` route` or
393170 ` loadbalancer` type listener in the Kafka CR.
394171
395- ## Clean Up Resources
396-
397- When you are finished, remove all Kafka resources to free up project quota:
398-
399- ```sh
400- # Delete the Kafka topic
401- oc delete kafkatopic my-topic -n <your-project>
402-
403- # Delete the Kafka cluster (also removes Entity Operator pods)
404- oc delete kafka my-cluster -n <your-project>
405-
406- # If using KafkaNodePool (in some configurations), delete it as well
407- oc delete kafkanodepool dual-role -n <your-project> 2>/dev/null || true
408-
409- # Remove the Strimzi Operator
410- oc delete -f install/cluster-operator/ -n <your-project>
411- ```
412-
413- !!! danger "Very Important Note"
414-
415- Deleting the Kafka cluster with ephemeral storage permanently destroys all
416- messages stored in that cluster. Make sure you have consumed or exported any
417- data you need before running these commands.
418-
419172---
0 commit comments