aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStaffan Olsson <staffan@repos.se>2016-09-05 08:57:20 +0200
committerStaffan Olsson <staffan@repos.se>2016-09-05 09:02:21 +0200
commit03454f1b6e9465d39d1b8cd30c540716364c5578 (patch)
tree86122f4e90f40d5520959528536cafb39a44a3ab
parent99f487d1e81404ba328c9330072e205bbc0cb176 (diff)
downloadkubernetes-kafka-03454f1b6e9465d39d1b8cd30c540716364c5578.tar.gz
kubernetes-kafka-03454f1b6e9465d39d1b8cd30c540716364c5578.tar.bz2
kubernetes-kafka-03454f1b6e9465d39d1b8cd30c540716364c5578.zip
Describes setup and some manual testing
-rw-r--r--README.md40
-rw-r--r--test/99testclient.yml14
-rw-r--r--test/test.sh13
3 files changed, 67 insertions, 0 deletions
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..2991e1a
--- /dev/null
+++ b/README.md
@@ -0,0 +1,40 @@
+
+# Kafka as Kubernetes PetSet
+
+Example of three Kafka brokers depending on three Zookeeper instances.
+
+## Set up volume claims
+
+This step can be skipped in clusters that support automatic volume provisioning, such as GKE.
+
+You need this step in Minikube.
+
+```
+./zookeeper/bootstrap/pv.sh
+kubectl create -f ./zookeeper/bootstrap/pvc.yml
+```
+
+```
+./bootstrap/pv.sh
+kubectl create -f ./bootstrap/pvc.yml
+# check that claims are bound
+kubectl get pvc
+```
+
+The volume size in the example is very small. The numbers don't really matter as long as they match. Minimal size on GKE is 1 GB.
+
+## Set up Zookeeper
+
+This module contains a copy of `pets/zookeeper/` from https://github.com/kubernetes/contrib.
+
+See the `./zookeeper` folder and follow the README there.
+
+## Start Kafka
+
+```
+kubectl create -f ./
+```
+
+## Testing manually
+
+See `./test/test.sh`.
diff --git a/test/99testclient.yml b/test/99testclient.yml
new file mode 100644
index 0000000..97cbf3d
--- /dev/null
+++ b/test/99testclient.yml
@@ -0,0 +1,14 @@
+# Kafka image without the service, so you can run ./bin/ stuff
+# kubectl exec -ti anythingclient -- /bin/bash
+apiVersion: v1
+kind: Pod
+metadata:
+ name: testclient
+spec:
+ containers:
+ - name: kafka
+ image: solsson/kafka:0.10.0.1
+ command:
+ - sh
+ - -c
+ - "exec tail -f /dev/null"
diff --git a/test/test.sh b/test/test.sh
new file mode 100644
index 0000000..f21fe87
--- /dev/null
+++ b/test/test.sh
@@ -0,0 +1,13 @@
+
+# Create topic
+kubectl exec testclient -- ./bin/kafka-topics.sh --zookeeper zookeeper:2181 --topic test1 --create --partitions 1 --replication-factor 1
+
+# Set one of your terminals to listen to messages on the test topic
+kubectl exec -ti testclient -- ./bin/kafka-console-consumer.sh --zookeeper zookeeper:2181 --topic test1 --from-beginning
+
+# Go ahead and produce topics, haven't found a way to do this directly through kubectl exec
+kubectl exec -ti testclient -- /bin/bash
+echo "Test $(date)" | ./bin/kafka-console-producer.sh --broker-list kafka-0.broker:9092 --topic test1
+echo "Test $(date)" | ./bin/kafka-console-producer.sh --broker-list kafka-1.broker:9092,kafka-2.broker:9092 --topic test1
+# "WARN Removing server from bootstrap.servers as DNS resolution failed: kafka-X.broker:9092"
+echo "Test $(date)" | ./bin/kafka-console-producer.sh --broker-list kafka-0.broker:9092,kafka-1.broker:9092,kafka-2.broker:9092,kafka-X.broker:9092 --topic test1