Skip to content

Instantly share code, notes, and snippets.

@kmtr
Created September 2, 2021 03:06
Show Gist options
  • Save kmtr/d86ed61604258eb277d5265b1c51f0c6 to your computer and use it in GitHub Desktop.
Save kmtr/d86ed61604258eb277d5265b1c51f0c6 to your computer and use it in GitHub Desktop.
# How to run Kafka using helm
2021-09-02
## Prerequisite
- local kubernetes cluster
- helm
- https://helm.sh/docs/intro/install/
## Install Kafka with helm
https://bitnami.com/stack/kafka/helm
## Install
### YAML
todo
values.yaml
```yaml
replicaCount: 3
autoCreateTopicsEnable: true
```
### Install
```shell-session
$ helm install my-release -f values.yaml bitnami/kafka
```
`my-release` is the release namespace.
### UnInstall
```shell-session
$ helm delete my-release
```
`my-release` is the release namespace.
## Run
```shell-session
$ kubectl get pods
NAME Ready STATUS RESTARTS AGE
my-release-kafka-client 1/1 Running 0 1m
...
$ kubectl exec --tty -i my-release-kafka-client --namespace default -- bash
```
### kafka-client
### Create Topic
```shell-session
$ kafka-topics.sh --zookeeper my-release-zookeeper.default.svc.cluster.local:2181 \
--create
--topic test
--replication-factor 1
--partitions 1
```
if you want to know the host of zookeeper, you should run this command outside of `kafka-client`.
```shell-session
$ kube ctl get services
```
## Produce and Consume
Look at the chart note.
```shell-session
$ helm show readme bitnami/kafka
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment