Skip to content

Commit e631d58

Browse files
committed
Updates readme for statefulset and the new zookeeper approach
1 parent df12385 commit e631d58

File tree

1 file changed

+17
-15
lines changed

1 file changed

+17
-15
lines changed

README.md

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,19 @@
11

22
# Kafka as Kubernetes PetSet
33

4-
Example of three Kafka brokers depending on three Zookeeper instances.
4+
Example of three Kafka brokers depending on five Zookeeper instances.
55

6-
To get consistent service DNS names `kafka-N.broker.kafka`(`.svc.cluster.local`), run everything in a namespace:
6+
To get consistent service DNS names `kafka-N.broker.kafka`(`.svc.cluster.local`), run everything in a [namespace](http://kubernetes.io/docs/admin/namespaces/walkthrough/):
77
```
88
kubectl create -f 00namespace.yml
99
```
1010

1111
## Set up volume claims
1212

13-
This step can be skipped in clusters that support automatic volume provisioning, such as GKE.
13+
You may add [storage class](http://kubernetes.io/docs/user-guide/persistent-volumes/#storageclasses)
14+
to the kafka StatefulSet declaration to enable automatic volume provisioning.
1415

15-
You need this step in Minikube.
16-
17-
```
18-
./zookeeper/bootstrap/pv.sh
19-
kubectl create -f ./zookeeper/bootstrap/pvc.yml
20-
```
16+
Alternatively create [PV](http://kubernetes.io/docs/user-guide/persistent-volumes/#persistent-volumes)s and [PVC](http://kubernetes.io/docs/user-guide/persistent-volumes/#persistentvolumeclaims)s manually. For example in Minikube.
2117

2218
```
2319
./bootstrap/pv.sh
@@ -26,21 +22,27 @@ kubectl create -f ./bootstrap/pvc.yml
2622
kubectl get pvc
2723
```
2824

29-
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.
30-
3125
## Set up Zookeeper
3226

33-
This module contains a copy of `pets/zookeeper/` from https://github.com/kubernetes/contrib.
27+
There is a Zookeeper+StatefulSet [blog post](http://blog.kubernetes.io/2016/12/statefulset-run-scale-stateful-applications-in-kubernetes.html) and [example](https://github.com/kubernetes/contrib/tree/master/statefulsets/zookeeper),
28+
but it appears tuned for workloads heavier than Kafka topic metadata.
3429

35-
See the `./zookeeper` folder and follow the README there.
30+
The Kafka book (Definitive Guide, O'Reilly 2016) recommends that Kafka has its own Zookeeper cluster,
31+
so we use the [official docker image](https://hub.docker.com/_/zookeeper/)
32+
but with a [startup script change to guess node id from hostname](https://github.com/solsson/zookeeper-docker/commit/df9474f858ad548be8a365cb000a4dd2d2e3a217).
3633

37-
An additional service has been added here, create using:
34+
Zookeeper runs as a [Deployment](http://kubernetes.io/docs/user-guide/deployments/) without persistent storage:
3835
```
39-
kubectl create -f ./zookeeper/service.yml
36+
kubectl create -f ./zookeeper/
4037
```
4138

39+
If you lose your zookeeper cluster, kafka will be unaware that persisted topics exist.
40+
The data is still there, but you need to re-create topics.
41+
4242
## Start Kafka
4343

44+
Assuming you have your PVCs `Bound`, or enabled automatic provisioning (see above), go ahead and:
45+
4446
```
4547
kubectl create -f ./
4648
```

0 commit comments

Comments
 (0)