forked from zabbix/zabbix-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
kubernetes.yaml
560 lines (560 loc) · 11.9 KB
/
kubernetes.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
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
apiVersion: v1
kind: Namespace
metadata:
name: zabbix
labels:
name: zabbix
---
apiVersion: v1
kind: Service
metadata:
name: zabbix-web
labels:
app: zabbix
namespace: zabbix
spec:
ports:
- port: 80
targetPort: 8080
name: web-http
- port: 443
targetPort: 8443
name: web-https
selector:
name: zabbix-web
externalIPs:
- <Specify external IP here>
---
apiVersion: v1
kind: Service
metadata:
name: mysql-server
labels:
app: zabbix
tier: db
namespace: zabbix
spec:
ports:
- port: 3306
targetPort: 3306
name: mysql-server
selector:
name: mysql-server
---
apiVersion: v1
kind: Service
metadata:
name: zabbix-server
labels:
app: zabbix
namespace: zabbix
spec:
ports:
- port: 10051
targetPort: 10051
name: zabbix-trapper
- port: 162
targetPort: 1162
protocol: UDP
name: snmp-trap
selector:
name: zabbix-server
externalIPs:
- <Specify external IP here>
---
apiVersion: v1
kind: Service
metadata:
name: zabbix-proxy-sqlite3
labels:
app: zabbix
namespace: zabbix
spec:
ports:
- port: 10051
targetPort: 10051
name: zabbix-trapper
- port: 162
targetPort: 1162
protocol: UDP
name: snmp-trap
selector:
name: zabbix-proxy-sqlite3
---
apiVersion: v1
kind: Service
metadata:
name: zabbix-proxy-mysql
labels:
app: zabbix
namespace: zabbix
spec:
ports:
- port: 10051
targetPort: 10051
name: zabbix-trapper
- port: 162
targetPort: 1162
protocol: UDP
name: snmp-trap
selector:
name: zabbix-proxy-mysql
---
apiVersion: v1
kind: Service
metadata:
name: zabbix-java-gateway
labels:
app: zabbix
namespace: zabbix
spec:
ports:
- port: 10052
targetPort: 10052
name: zabbix-jmx
selector:
name: zabbix-java-gateway
---
apiVersion: v1
kind: Service
metadata:
name: zabbix-agent
labels:
app: zabbix
namespace: zabbix
spec:
ports:
- port: 10050
targetPort: 10050
name: zabbix-agent
selector:
name: zabbix-agent
---
apiVersion: v1
kind: ReplicationController
metadata:
name: zabbix-web
labels:
app: zabbix
tier: zabbix-web
namespace: zabbix
spec:
replicas: 2
template:
metadata:
labels:
name: zabbix-web
app: zabbix
spec:
containers:
- name: zabbix-web
image: zabbix/zabbix-web-nginx-mysql:alpine-5.0-latest
imagePullPolicy: Always
ports:
- containerPort: 8080
name: web-http
- containerPort: 8443
name: web-https
resources:
limits:
cpu: 200m
memory: 400Mi
requests:
cpu: 200m
memory: 400Mi
livenessProbe:
httpGet:
path: /
port: web-http
scheme: HTTP
initialDelaySeconds: 15
timeoutSeconds: 2
periodSeconds: 10
successThreshold: 1
failureThreshold: 5
readinessProbe:
httpGet:
path: /
port: web-http
scheme: HTTP
initialDelaySeconds: 15
timeoutSeconds: 2
periodSeconds: 10
successThreshold: 1
failureThreshold: 5
env:
- name: ZBX_SERVER_NAME
value: "Zabbix kubernetes"
- name: PHP_TZ
value: "Europe/Riga"
- name: MYSQL_USER
valueFrom:
secretKeyRef:
name: db-secret
key: db-zbx-user
- name: MYSQL_PASSWORD
valueFrom:
secretKeyRef:
name: db-secret
key: db-zbx-pass
- name: MYSQL_ROOT_PASSWORD
valueFrom:
secretKeyRef:
name: db-secret
key: db-root-pass
- name: MYSQL_DATABASE
value: "zabbix"
volumeMounts:
- name: zabbix-web-ssl
mountPath: /etc/ssl/nginx
readOnly: true
volumes:
- hostPath:
path: /home/dotneft/zbx/zbx_env/etc/ssl/nginx/
name: zabbix-web-ssl
---
apiVersion: v1
kind: ReplicationController
metadata:
name: mysql-server
labels:
app: zabbix
tier: mysql-server
namespace: zabbix
spec:
replicas: 1
template:
metadata:
labels:
name: mysql-server
app: zabbix
tier: mysql-server
spec:
volumes:
- name: zabbix-mysql-data
persistentVolumeClaim:
claimName: zabbix-mysql-data-claim
containers:
- name: zabbix-db
image: mysql:5.7
ports:
- containerPort: 3306
name: mysql
env:
- name: MYSQL_USER
valueFrom:
secretKeyRef:
name: db-secret
key: db-zbx-user
- name: MYSQL_PASSWORD
valueFrom:
secretKeyRef:
name: db-secret
key: db-zbx-pass
- name: MYSQL_ROOT_PASSWORD
valueFrom:
secretKeyRef:
name: db-secret
key: db-root-pass
- name: MYSQL_DATABASE
value: "zabbix"
volumeMounts:
- mountPath: "/var/lib/mysql/"
name: zabbix-mysql-data
readOnly: false
---
apiVersion: v1
kind: ReplicationController
metadata:
name: zabbix-server
labels:
app: zabbix
tier: server
environment: dev
namespace: zabbix
spec:
replicas: 1
template:
metadata:
labels:
name: zabbix-server
app: zabbix
spec:
containers:
- name: zabbix-server
image: zabbix/zabbix-server-mysql:alpine-5.0-latest
imagePullPolicy: Always
ports:
- containerPort: 10051
protocol: TCP
name: zabbix-trapper
readinessProbe:
tcpSocket:
port: zabbix-trapper
initialDelaySeconds: 5
periodSeconds: 10
livenessProbe:
tcpSocket:
port: zabbix-trapper
initialDelaySeconds: 15
periodSeconds: 20
env:
- name: MYSQL_USER
valueFrom:
secretKeyRef:
name: db-secret
key: db-zbx-user
- name: MYSQL_PASSWORD
valueFrom:
secretKeyRef:
name: db-secret
key: db-zbx-pass
- name: MYSQL_ROOT_PASSWORD
valueFrom:
secretKeyRef:
name: db-secret
key: db-root-pass
- name: MYSQL_DATABASE
value: "zabbix"
- name: ZBX_JAVAGATEWAY_ENABLE
value: "true"
- name: ZBX_STARTJAVAPOLLERS
value: "5"
- name: ZBX_ENABLE_SNMP_TRAPS
value: "true"
- name: ZBX_STARTPROXYPOLLERS
value: "5"
- name: ZBX_PROXYCONFIGFREQUENCY
value: "60"
volumeMounts:
- name: zabbix-db-storage
mountPath: /var/lib/zabbix/snmptraps/
readOnly: true
- name: zabbix-snmptraps
image: zabbix/zabbix-snmptraps:alpine-5.0-latest
imagePullPolicy: Always
ports:
- containerPort: 1162
protocol: UDP
name: snmp-trap
volumeMounts:
- name: zabbix-db-storage
mountPath: /var/lib/zabbix/snmptraps/
readOnly: false
volumes:
- hostPath:
path: /zabbix/
name: zabbix-db-storage
---
apiVersion: v1
kind: ReplicationController
metadata:
name: zabbix-proxy-sqlite3
labels:
app: zabbix
tier: proxy
namespace: zabbix
spec:
replicas: 1
template:
metadata:
labels:
name: zabbix-proxy-sqlite3
app: zabbix
spec:
containers:
- name: zabbix-proxy-sqlite3
image: zabbix/zabbix-proxy-sqlite3:alpine-5.0-latest
imagePullPolicy: Always
ports:
- containerPort: 10051
protocol: TCP
name: zabbix-trapper
env:
- name: ZBX_HOSTNAME
value: "zabbix-proxy-passive"
- name: ZBX_CONFIGFREQUENCY
value: "60"
- name: ZBX_PROXYMODE
value: "1"
---
apiVersion: v1
kind: ReplicationController
metadata:
name: zabbix-proxy-mysql
labels:
app: zabbix
tier: proxy
namespace: zabbix
spec:
replicas: 1
template:
metadata:
labels:
name: zabbix-proxy-mysql
app: zabbix
spec:
containers:
- name: zabbix-proxy-mysql
image: zabbix/zabbix-proxy-mysql:alpine-5.0-latest
imagePullPolicy: Always
ports:
- containerPort: 10051
protocol: TCP
name: zabbix-trapper
env:
- name: MYSQL_USER
valueFrom:
secretKeyRef:
name: db-secret
key: db-zbx-user
- name: MYSQL_PASSWORD
valueFrom:
secretKeyRef:
name: db-secret
key: db-zbx-pass
- name: MYSQL_ROOT_PASSWORD
valueFrom:
secretKeyRef:
name: db-secret
key: db-root-pass
- name: MYSQL_DATABASE
value: "zabbix_proxy"
---
apiVersion: v1
kind: ReplicationController
metadata:
name: zabbix-java-gateway
labels:
app: zabbix
tier: java
namespace: zabbix
spec:
replicas: 1
template:
metadata:
labels:
name: zabbix-java-gateway
app: zabbix
spec:
containers:
- name: zabbix-java-gateway
image: zabbix/zabbix-java-gateway:alpine-5.0-latest
imagePullPolicy: Always
ports:
- containerPort: 10052
protocol: TCP
name: zabbix-jmx
env:
- name: ZBX_TIMEOUT
value: "5"
---
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: zabbix-agent
labels:
app: zabbix
tier: agent
namespace: zabbix
spec:
selector:
matchLabels:
name: zabbix-agent
updateStrategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 1
template:
metadata:
labels:
name: zabbix-agent
app: zabbix
spec:
containers:
- name: zabbix-agent
image: zabbix/zabbix-agent:alpine-5.0-latest
imagePullPolicy: Always
resources:
limits:
cpu: 100m
memory: 54Mi
requests:
cpu: 100m
memory: 54Mi
ports:
- containerPort: 10050
name: zabbix-agent
env:
- name: ZBX_SERVER_HOST
value: "zabbix-server"
- name: ZBX_PASSIVE_ALLOW
value: "true"
- name: ZBX_STARTAGENTS
value: "3"
- name: ZBX_TIMEOUT
value: "10"
securityContext:
privileged: true
---
apiVersion: autoscaling/v2beta1
kind: HorizontalPodAutoscaler
metadata:
name: zabbix-web
namespace: zabbix
spec:
scaleTargetRef:
apiVersion: v1
kind: ReplicationController
name: zabbix-web
minReplicas: 1
maxReplicas: 5
metrics:
- type: Resource
resource:
name: cpu
targetAverageUtilization: 70
---
kind: PersistentVolume
apiVersion: v1
metadata:
name: zabbix-mysql-data
labels:
type: local
namespace: zabbix
spec:
capacity:
storage: 1Gi
accessModes:
- ReadWriteOnce
hostPath:
path: "/data"
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: zabbix-mysql-data-claim
namespace: zabbix
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
volumeName: zabbix-mysql-data
---
apiVersion: v1
kind: List
metadata:
namespace: zabbix
items:
- apiVersion: v1
kind: Secret
type: Opaque
metadata:
name: db-secret
namespace: zabbix
data:
db-root-pass: "c29tZV90ZXN0X3Bhc3M="
db-zbx-user: "emFiYml4"
db-zbx-pass: "emJ4X3Bhc3N3b3Jk"