-
Notifications
You must be signed in to change notification settings - Fork 20
/
kafka-persistent.yaml
116 lines (116 loc) · 2.94 KB
/
kafka-persistent.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
apiVersion: v1
kind: Service
metadata:
name: kafka-persistent
labels:
app: kafka-persistent
component: kafka
annotations:
service.alpha.kubernetes.io/tolerate-unready-endpoints: "true"
spec:
ports:
- port: 9092
name: server
clusterIP: None
selector:
app: kafka-persistent
component: kafka
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: kafka-persistent
labels:
app: kafka-persistent
component: kafka
# annotations:
## Use this annotation if you want allocate each pod on different node
## Note the number of nodes must be upper than REPLICAS parameter.
# scheduler.alpha.kubernetes.io/affinity: >
# {
# "podAntiAffinity": {
# "requiredDuringSchedulingIgnoredDuringExecution": [{
# "labelSelector": {
# "matchExpressions": [{
# "key": "app",
# "operator": "In",
# "values": ["kafka"]
# }]
# },
# "topologyKey": "kubernetes.io/hostname"
# }]
# }
# }
spec:
serviceName: kafka-persistent
selector:
matchLabels:
app: kafka-persistent
component: kafka
replicas: 3
podManagementPolicy: "Parallel"
template:
metadata:
labels:
app: kafka-persistent
component: kafka
spec:
securityContext:
runAsUser: 1001
fsGroup: 1001
containers:
- name: kafka
imagePullPolicy: IfNotPresent
image: engapa/kafka:2.13-2.5.0
resources:
requests:
memory: 512M
cpu: 300m
limits:
memory: 512M
cpu: 300m
ports:
- containerPort: 9092
name: broker-port
env:
- name: KAFKA_REPLICAS
value: "3"
- name: KAFKA_ZK_LOCAL
value: "false"
- name: KAFKA_HEAP_OPTS
value: "-Xmx250M -Xms250M"
- name: SERVER_num_partitions
value: "1"
- name: SERVER_delete_topic_enable
value: "true"
- name: SERVER_log_retention_hours
value: "2147483647"
- name: SERVER_zookeeper_connect
value: "zk-0.zk:2181,zk-1.zk:2181,zk-2.zk:2181"
- name: SERVER_log_dirs
value: "/opt/kafka/data/logs"
- name: SERVER_zookeeper_connection_timeout_ms
value: "300000"
livenessProbe:
exec:
command:
- kafka_server_status.sh
initialDelaySeconds: 30
timeoutSeconds: 5
readinessProbe:
exec:
command:
- kafka_server_status.sh
initialDelaySeconds: 30
timeoutSeconds: 5
volumeMounts:
- name: data
mountPath: /opt/kafka/data
volumeClaimTemplates:
- metadata:
name: data
spec:
accessModes: [ "ReadWriteOnce" ]
resources:
requests:
storage: 1Gi