k8s部署kafka

1 空间创建

1
kubectl create namespace kafka

2 安装operator

1
kubectl create -f 'https://strimzi.io/install/latest?namespace=kafka' -n kafka

3 查看安装情况

1
2
kubectl get pod -n kafka --watch
kubectl logs deployment/strimzi-cluster-operator -n kafka -f

4 下载kafka清单文件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
wget -c https://strimzi.io/examples/latest/kafka/kafka-persistent.yaml
vi kafka-persistent-single.yaml
# 我配置了3个kafka和3个zk
apiVersion: kafka.strimzi.io/v1beta2
kind: Kafka
metadata:
name: my-cluster
spec:
kafka:
version: 3.3.1
replicas: 3
listeners:
- name: plain
port: 9092
type: internal
tls: false
- name: tls
port: 9093
type: internal
tls: true
config:
offsets.topic.replication.factor: 3
transaction.state.log.replication.factor: 3
transaction.state.log.min.isr: 2
default.replication.factor: 3
min.insync.replicas: 2
inter.broker.protocol.version: "3.3"
storage:
type: jbod
volumes:
- id: 0
type: persistent-claim
size: 100Gi
deleteClaim: false
zookeeper:
replicas: 3
storage:
type: persistent-claim
size: 100Gi
deleteClaim: false
entityOperator:
topicOperator: {}
userOperator: {}

5 安装kafka

1
kubectl create -f kafka-persistent-single.yaml

k8s部署kafka
https://leellun.github.io/2022/11/04/k8s/服务部署/2022-11-04-k8s部署kafka/
作者
leellun
发布于
2022年11月4日
许可协议