You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+17-15Lines changed: 17 additions & 15 deletions
Original file line number
Diff line number
Diff line change
@@ -1,23 +1,19 @@
1
1
2
2
# Kafka as Kubernetes PetSet
3
3
4
-
Example of three Kafka brokers depending on three Zookeeper instances.
4
+
Example of three Kafka brokers depending on five Zookeeper instances.
5
5
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/):
7
7
```
8
8
kubectl create -f 00namespace.yml
9
9
```
10
10
11
11
## Set up volume claims
12
12
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.
14
15
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.
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
-
31
25
## Set up Zookeeper
32
26
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.
34
29
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).
36
33
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:
38
35
```
39
-
kubectl create -f ./zookeeper/service.yml
36
+
kubectl create -f ./zookeeper/
40
37
```
41
38
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
+
42
42
## Start Kafka
43
43
44
+
Assuming you have your PVCs `Bound`, or enabled automatic provisioning (see above), go ahead and:
0 commit comments