Skip to main content

Tiny Kafka

This example demonstrates using Zarf to deploy a simple operator example, in this case, Strimzi Kafka Operator](https://strimzi.io/).

info

To view the example source code, select the Edit this page link below the article and select the parent folder.

Prerequisites

Before the magic can happen you have to do a few things:

  1. Install Docker. Other container engines will likely work as well but aren't actively tested by the Zarf team.

  2. Install Kind. Other Kubernetes distros will work as well, but we'll be using Kind for this example since it is easy and tested frequently and thoroughly.

  3. Clone the Zarf project for the example configuration files.

  4. Build the package using zarf package create examples/tiny-kafka

  5. Create a Zarf cluster as described in the Initializing a Cluster Walkthrough

Instructions

Deploy the package

Run the following command to deploy the created package to the cluster

zarf package deploy zarf-package-tiny-kafka-amd64.tar.zst --confirm

Wait a few seconds for the cluster to deploy the package.

Access Kafka

Testing requires JDK and the Kafka tools: sudo apt install openjdk-14-jdk-headless (on Ubuntu). More details can be found at https://kafka.apache.org/quickstart. Steps to test:

  1. Install JDK and extract the Kafka tools from the package kafka.tgz
  2. Get the Nodeport: NODEPORT=$(zarf tools kubectl get service demo-kafka-external-bootstrap -n kafka-demo -o=jsonpath='{.spec.ports[0].nodePort}{"\n"}')
  3. For pub: ./bin/kafka-console-producer.sh --broker-list localhost:$NODEPORT --topic cool-topic
  4. For sub: ./bin/kafka-console-consumer.sh --bootstrap-server localhost:$NODEPORT --topic cool-topic