# Test client for producing and consuming Kafka messages
#
# 2. Log into the Pod
#
#   kubectl exec -it kafka-client -- /bin/bash
#
# 3. Explore with kafka commands:
#
#   # Create the topic
#   kafka-topics --zookeeper confluent-kafka-cp-zookeeper-headless:2181 --topic confluent-kafka-topic --create --partitions 1 --replication-factor 1 --if-not-exists
#
#   # Create a message
#   MESSAGE="`date -u`"
#
#   # Produce a test message to the topic
#   echo "$MESSAGE" | kafka-console-producer --broker-list confluent-kafka-cp-kafka-headless:9092 --topic confluent-kafka-topic
#
#   # Consume a test message from the topic
#   kafka-console-consumer --bootstrap-server confluent-kafka-cp-kafka-headless:9092 --topic confluent-kafka-topic --from-beginning --timeout-ms 2000 --max-messages 1 | grep "$MESSAGE"

apiVersion: v1
kind: Pod
metadata:
  name: kafka-client
  namespace: default
spec:
  containers:
  - name: kafka-client
    image: confluentinc/cp-kafka:5.0.0
    command:
      - sh
      - -c
      - "exec tail -f /dev/null"
