-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathkafka-zk.yaml
183 lines (182 loc) · 5.21 KB
/
kafka-zk.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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
kind: Template
apiVersion: v1
metadata:
name: kafka-zk
annotations:
openshift.io/display-name: Kafka [+Zookeeper] (Ephemeral)
description: Deploy a Kafka cluster, an optional zookeeper could be deployed too.
iconClass: icon-database
tags: messaging,kafka
labels:
template: kafka-zk
component: kafka
parameters:
- name: NAME
description: Name.
required: true
value: kafka-zk
- name: KAFKA_VERSION
description: Kafka Version (Scala and kafka version).
required: true
value: "2.13-2.5.0"
- name: SOURCE_IMAGE
description: Container image source.
value: kafka
required: true
- name: REPLICAS
description: Number of replicas.
required: true
value: "1"
- name: ZK_HEAP_OPTS
description: Zookeeper JVM Heap options. Consider value of params RESOURCE_MEMORY_REQ, RESOURCE_MEMORY_LIMIT and KAFKA_HEAP_OPTS.
required: true
value: "-Xmx512M -Xms512M"
- name: KAFKA_HEAP_OPTS
description: Kafka JVM Heap options. Consider value of params RESOURCE_MEMORY_REQ, RESOURCE_MEMORY_LIMIT and ZK_HEAP_OPTS.
required: true
value: "-Xmx512M -Xms512M"
- name: SERVER_NUM_PARTITIONS
description: >
The default number of log partitions per topic.
More partitions allow greater
parallelism for consumption, but this will also result in more files across
the brokers.
required: true
value: "1"
- name: SERVER_DELETE_TOPIC_ENABLE
description: >
Topic deletion enabled.
Switch to enable topic deletion or not, default value is 'false'.
value: "false"
- name: SERVER_LOG_RETENTION_HOURS
description: >
Log retention hours.
The minimum age of a log file to be eligible for deletion.
value: "40"
- name: KAFKA_ZK_LOCAL
description: >
Use local zookeeper (*KAFKA_ZK_LOCAL).
Set value to 'true' to start a local zookeeper process into the same container.
required: true
value: "true"
- name: SERVER_ZOOKEEPER_CONNECT
description: >
Zookeeper connection list as URL, nodes separated by ','.
This value takes effect when KAFKA_ZK_LOCAL is false, in other case this value will be auto-generated internally.
value: "localhost:2181"
- name: SERVER_ZOOKEEPER_CONNECT_TIMEOUT
description: >
The max time that the client waits to establish a connection to zookeeper (ms).
value: "6000"
required: true
- name: RESOURCE_MEMORY_REQ
description: The memory resource request.
value: "512M"
- name: RESOURCE_MEMORY_LIMIT
description: The limits for memory resource.
value: "512M"
- name: RESOURCE_CPU_REQ
description: The CPU resource request.
value: "300m"
- name: RESOURCE_CPU_LIMIT
description: The limits for CPU resource.
value: "300m"
objects:
- apiVersion: v1
kind: Service
metadata:
name: ${NAME}
labels:
component: kafka
annotations:
service.alpha.kubernetes.io/tolerate-unready-endpoints: "true"
spec:
ports:
- port: 9092
name: server
- port: 2181
name: zkclient
- port: 2888
name: zkserver
- port: 3888
name: zkleader
clusterIP: None
selector:
app: ${NAME}
component: kafka
- apiVersion: apps/v1
kind: StatefulSet
metadata:
name: ${NAME}
labels:
app: ${NAME}
component: ${NAME}
spec:
podManagementPolicy: "Parallel"
serviceName: ${NAME}
selector:
matchLabels:
app: ${NAME}
component: kafka
replicas: ${REPLICAS}
template:
metadata:
labels:
app: ${NAME}
template: kafka-zk
component: kafka
spec:
securityContext:
runAsUser: 1001
fsGroup: 1001
containers:
- name: ${NAME}
imagePullPolicy: IfNotPresent
image: ${SOURCE_IMAGE}:${KAFKA_VERSION}
resources:
requests:
memory: ${RESOURCE_MEMORY_REQ}
cpu: ${RESOURCE_CPU_REQ}
limits:
memory: ${RESOURCE_MEMORY_LIMIT}
cpu: ${RESOURCE_CPU_LIMIT}
ports:
- containerPort: 9092
name: server
- containerPort: 2181
name: zkclient
- containerPort: 2888
name: zkserver
- containerPort: 3888
name: zkleader
env:
- name : KAFKA_REPLICAS
value: ${REPLICAS}
- name: KAFKA_ZK_LOCAL
value: ${KAFKA_ZK_LOCAL}
- name : ZOO_HEAP_OPTS
value: ${ZK_HEAP_OPTS}
- name: KAFKA_HEAP_OPTS
value: ${KAFKA_HEAP_OPTS}
- name: SERVER_num_partitions
value: ${SERVER_NUM_PARTITIONS}
- name: SERVER_delete_topic_enable
value: ${SERVER_DELETE_TOPIC_ENABLE}
- name: SERVER_log_retention_hours
value: ${SERVER_LOG_RETENTION_HOURS}
- name: SERVER_zookeeper_connect
value: ${SERVER_ZOOKEEPER_CONNECT}
- name: SERVER_zookeeper_connection_timeout_ms
value: ${SERVER_ZOOKEEPER_CONNECT_TIMEOUT}
readinessProbe:
exec:
command:
- kafka_server_status.sh
initialDelaySeconds: 30
timeoutSeconds: 5
livenessProbe:
exec:
command:
- kafka_server_status.sh
initialDelaySeconds: 30
timeoutSeconds: 5