tree: c5ec95ab115f1367a54a4a6a1a9efdd8bebfe095 [path history] [tgz]
  1. kafka.tf
  2. provider.tf
  3. README.md
.test-infra/kafka/bitnami/README.md

Overview

This module provisions a Bitnami Kafka Cluster based on its helm chart. It uses the terraform helm provider Therefore, you DO NOT need helm to apply this module.

Requirements

Usage

Simply follow standard terraform workflow to apply this module.

terraform init
terraform apply

Special note about GKE Autopilot

When applying this module to Google Kubernetes Engine (GKE) Autopilot you will see an “Unschedulable” status. This is because, GKE Autopilot needs time to scale up the node. After some time, the kubernetes cluster will provision the kafka cluster when these compute resources are available.

Debugging and Troubleshooting

This module deploys a kafka client on the cluster to help with debugging and troubleshooting.

Query the kafka client pod name

Run the following command to query the pod name.

kubectl get po -l app=kafka-client

You should see something similar to the following:

NAME                           READY   STATUS    RESTARTS   AGE
kafka-client-cdc7c8885-nmcjc   1/1     Running   0          4m12s

Get a shell to the running container

Run the following command to shell into the running container.

kubectl exec --stdin --tty kafka-client-cdc7c8885-nmcjc -- /bin/bash

Execute kafka commands

The container executes using the latest bitnami/kafka image. It has installed all the necessary kafka-*.sh scripts in its path.

In all of the commands, you can use the flag: --bootstrap-server kafka:9092 because the pod is in the same kubernetes cluster and takes advantage of its domain name service (DNS). The bitnami helm operator creates a Kubernetes service called kafka that exposes port 9092.

Get the cluster-id

The following command gives you the cluster ID and validates you can connect to the cluster.

kafka-cluster.sh cluster-id --bootstrap-server kafka:9092

Create a topic

The following command creates a Kafka topic.

kafka-topics.sh --create --topic some-topic --partitions 3 --replication-factor 3 --bootstrap-server kafka:9092

Get information about a topic

The following command queries information about a topic (assuming the name some-topic).

kafka-topics.sh --describe --topic some-topic --bootstrap-server kafka:9092

See https://kubernetes.io/docs/tasks/debug/debug-application/get-shell-running-container/