-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathstatefulset.yaml
69 lines (69 loc) · 1.88 KB
/
statefulset.yaml
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: kafka
spec:
selector:
matchLabels:
app: kafka
serviceName: kafka-broker
replicas: 2
template:
metadata:
labels:
app: kafka
spec:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/arch
operator: In
values:
- amd64
- arm64
containers:
- name: broker
image: medinvention/kafka:2.13-2.7.0
env:
- name: HOSTNAME_VALUE
valueFrom:
fieldRef:
fieldPath: status.podIP
- name: KAFKA_LISTENERS_COMMAND
value: "echo \"PLAINTEXT://${HOSTNAME}.kafka-broker.kafka.svc.cluster.local:9092\""
- name: KAFKA_LOG4J_OPTS
value: "-Dlog4j.configuration=file:/opt/kafka/config/log4j.properties"
- name: BROKER_ID_COMMAND
value: "echo ${HOSTNAME##*-}"
- name: KAFKA_ZOOKEEPER_CONNECT
value: "zk-cs.kafka.svc.cluster.local:2181"
- name: KAFKA_LOG_DIRS
value: "/var/lib/kafka/data/topics"
- name: KAFKA_LOG_RETENTION_HOURS
value: "-1"
- name: KAFAK_ZOOKEEPER_CONNECTION_TIMEOUT_MS
value: "6000"
- name: KAFAK_AUTO_CREATE_TOPICS_ENABLE
value: "false"
ports:
- containerPort: 9092
livenessProbe:
initialDelaySeconds: 60
exec:
command:
- /bin/sh
- -c
- 'netstat -tulpn | grep LISTEN | grep 9092'
volumeMounts:
- name: data
mountPath: /var/lib/kafka/data
volumeClaimTemplates:
- metadata:
name: data
spec:
accessModes: [ "ReadWriteOnce" ]
resources:
requests:
storage: 500Mi