|
1 |
| -_Manifests here require Kubernetes 1.8 now. |
2 |
| -On earlier versions use [v2.1.0](https://github.com/Yolean/kubernetes-kafka/tree/v2.1.0)._ |
| 1 | +# Kafka for Kubernetes |
3 | 2 |
|
4 |
| -# Kafka on Kubernetes |
| 3 | +This community seeks to provide: |
| 4 | + * Production-worthy Kafka setup for persistent (domain- and ops-) data at small scale. |
| 5 | + * Operational knowledge, biased towards resilience over throughput, as Kubernetes manifest. |
| 6 | + * A platform for event-driven (streaming!) microservices design using Kubernetes. |
5 | 7 |
|
6 |
| -Transparent Kafka setup that you can grow with. |
7 |
| -Good for both experiments and production. |
| 8 | +To quote [@arthurk](https://github.com/Yolean/kubernetes-kafka/issues/82#issuecomment-337532548): |
8 | 9 |
|
9 |
| -How to use: |
10 |
| - * Good to know: you'll likely want to fork this repo. It prioritizes clarity over configurability, using plain manifests and .propeties files; no client side logic. |
11 |
| - * Run a Kubernetes cluster, [minikube](https://github.com/kubernetes/minikube) or real. |
12 |
| - * Quickstart: use the `kubectl apply`s below. |
13 |
| - * Have a look at [addon](https://github.com/Yolean/kubernetes-kafka/labels/addon)s, or the official forks: |
14 |
| - - [kubernetes-kafka-small](https://github.com/Reposoft/kubernetes-kafka-small) for single-node clusters like Minikube. |
15 |
| - - [StreamingMicroservicesPlatform](https://github.com/StreamingMicroservicesPlatform/kubernetes-kafka) Like Confluent's [platform quickstart](https://docs.confluent.io/current/connect/quickstart.html) but for Kubernetes. |
16 |
| - * Join the discussion in issues and PRs. |
| 10 | +> thanks for creating and maintaining this Kubernetes files, they're up-to-date (unlike the kubernetes contrib files, don't require helm and work great! |
17 | 11 |
|
18 |
| -No readable readme can properly introduce both [Kafka](http://kafka.apache.org/) and [Kubernetes](https://kubernetes.io/), |
19 |
| -but we think the combination of the two is a great backbone for microservices. |
20 |
| -Back when we read [Newman](http://samnewman.io/books/building_microservices/) we were beginners with both. |
21 |
| -Now we've read [Kleppmann](http://dataintensive.net/), [Confluent](https://www.confluent.io/blog/) and [SRE](https://landing.google.com/sre/book.html) and enjoy this "Streaming Platform" lock-in :smile:. |
| 12 | +## Getting started |
22 | 13 |
|
23 |
| -We also think the plain-yaml approach of this project is easier to understand and evolve than [helm](https://github.com/kubernetes/helm) [chart](https://github.com/kubernetes/charts/tree/master/incubator/kafka)s. |
| 14 | +We suggest you `apply -f` manifests in the following order: |
| 15 | + * Your choice of storage classes from [./configure](./configure/) |
| 16 | + * [namespace](./00-namespace.yml) |
| 17 | + * [./rbac-namespace-default](./rbac-namespace-default/) |
| 18 | + * [./zookeeper](./zookeeper/) |
| 19 | + * [./kafka](./kafka/) |
24 | 20 |
|
25 |
| -## What you get |
| 21 | +That'll give you client "bootstrap" `bootstrap.kafka.svc.cluster.local:9092`. |
26 | 22 |
|
27 |
| -Keep an eye on `kubectl --namespace kafka get pods -w`. |
| 23 | +## Fork |
28 | 24 |
|
29 |
| -The goal is to provide [Bootstrap servers](http://kafka.apache.org/documentation/#producerconfigs): `kafka-0.broker.kafka.svc.cluster.local:9092,kafka-1.broker.kafka.svc.cluster.local:9092,kafka-2.broker.kafka.svc.cluster.local:9092` |
30 |
| -` |
| 25 | +Our only dependency is `kubectl`. Not because we dislike Helm or Operators, but because we think plain manifests make it easier to collaborate. |
| 26 | +If you begin to rely on this kafka setup we recommend you fork, for example to edit [broker config](https://github.com/Yolean/kubernetes-kafka/blob/master/kafka/10broker-config.yml#L47). |
31 | 27 |
|
32 |
| -Zookeeper at `zookeeper.kafka.svc.cluster.local:2181`. |
| 28 | +## Version history |
33 | 29 |
|
34 |
| -## Prepare storage classes |
| 30 | +| tag | k8s ≥ | highlights | |
| 31 | +| ----- | ------ | ---------- | |
| 32 | +| 4.x | 1.9+ | Kafka 1.1 dynamic config | |
| 33 | +| v4.1 | 1.9+ | Kafka 1.0.1 new [default](#148) [config](#170) | |
| 34 | +| v3.2 | 1.9.4, 1.8.9, 1.7.14 | Required for read-only ConfigMaps [#162](https://github.com/Yolean/kubernetes-kafka/issues/162) [#163](https://github.com/Yolean/kubernetes-kafka/pull/163) [k8s #58720](https://github.com/kubernetes/kubernetes/pull/58720) | |
| 35 | +| v3.1 | 1.8 | The painstaking path to `min.insync.replicas`=2 | |
| 36 | +| v3.0 | 1.8 | [Outside access](#78), [modern manifests](#84), [bootstrap.kafka](#52) | |
| 37 | +| v2.1 | 1.5 | Kafka 1.0, the init script concept | |
| 38 | +| v2.0 | 1.5 | [addon](https://github.com/Yolean/kubernetes-kafka/labels/addon)s | |
| 39 | +| v1.0 | 1 | Stateful? In Kubernetes? In 2016? Yes. | |
35 | 40 |
|
36 |
| -For Minikube run `kubectl apply -f configure/minikube-storageclass-broker.yml; kubectl apply -f configure/minikube-storageclass-zookeeper.yml`. |
| 41 | +All available as [releases](https://github.com/Yolean/kubernetes-kafka/releases). |
37 | 42 |
|
38 |
| -There's a similar setup for GKE, `configure/gke-*`. You might want to tweak it before creating. |
| 43 | +## Monitoring |
39 | 44 |
|
40 |
| -## Start Zookeeper |
| 45 | +Have a look at: |
| 46 | + * [./prometheus](./prometheus/) |
| 47 | + * [./linkedin-burrow](./linkedin-burrow/) |
| 48 | + * [or plain JMX](https://github.com/Yolean/kubernetes-kafka/pull/96) |
| 49 | + * what's happening in the [monitoring](https://github.com/Yolean/kubernetes-kafka/labels/monitoring) label. |
| 50 | + * Note that this repo is intentionally light on [automation](https://github.com/Yolean/kubernetes-kafka/labels/automation). We think every SRE team must build the operational knowledge first. |
41 | 51 |
|
42 |
| -The [Kafka book](https://www.confluent.io/resources/kafka-definitive-guide-preview-edition/) recommends that Kafka has its own Zookeeper cluster with at least 5 instances. |
| 52 | +## Outside (out-of-cluster) access |
43 | 53 |
|
44 |
| -``` |
45 |
| -kubectl apply -f ./zookeeper/ |
46 |
| -``` |
| 54 | +Available for: |
47 | 55 |
|
48 |
| -To support automatic migration in the face of availability zone unavailability we mix persistent and ephemeral storage. |
| 56 | + * [Brokers](./outside-services/) |
49 | 57 |
|
50 |
| -## Start Kafka |
| 58 | +## Fewer than three nodes? |
51 | 59 |
|
52 |
| -``` |
53 |
| -kubectl apply -f ./kafka/ |
54 |
| -``` |
| 60 | +For [minikube](https://github.com/kubernetes/minikube/), [youkube](https://github.com/Yolean/youkube) etc: |
55 | 61 |
|
56 |
| -You might want to verify in logs that Kafka found its own DNS name(s) correctly. Look for records like: |
57 |
| -``` |
58 |
| -kubectl -n kafka logs kafka-0 | grep "Registered broker" |
59 |
| -# INFO Registered broker 0 at path /brokers/ids/0 with addresses: PLAINTEXT -> EndPoint(kafka-0.broker.kafka.svc.cluster.local,9092,PLAINTEXT) |
60 |
| -``` |
| 62 | + * [Scale 1](https://github.com/Yolean/kubernetes-kafka/pull/44) |
| 63 | + * [Scale 2](https://github.com/Yolean/kubernetes-kafka/pull/118) |
61 | 64 |
|
62 |
| -That's it. Just add business value :wink:. |
| 65 | +## Stream... |
63 | 66 |
|
64 |
| -## RBAC |
65 |
| - |
66 |
| -For clusters that enfoce [RBAC](https://kubernetes.io/docs/admin/authorization/rbac/) there's a minimal set of policies in |
67 |
| -``` |
68 |
| -kubectl apply -f rbac-namespace-default/ |
69 |
| -``` |
70 |
| - |
71 |
| -## Tests |
72 |
| - |
73 |
| -Tests are based on the [kube-test](https://github.com/Yolean/kube-test) concept. |
74 |
| -Like the rest of this repo they have `kubectl` as the only local dependency. |
75 |
| - |
76 |
| -Run self-tests or not. They do generate some load, but indicate if the platform is working or not. |
77 |
| - * To include tests, replace `apply -f` with `apply -R -f` in your `kubectl`s above. |
78 |
| - * Anything that isn't READY in `kubectl get pods -l test-type=readiness --namespace=test-kafka` is a failed test. |
| 67 | + * [Kubernetes events to Kafka](./events-kube/) |
| 68 | + * [Container logs to Kafka](https://github.com/Yolean/kubernetes-kafka/pull/131) |
| 69 | + * [Heapster metrics to Kafka](https://github.com/Yolean/kubernetes-kafka/pull/120) |
0 commit comments