-
Notifications
You must be signed in to change notification settings - Fork 30
/
database-mysql.yaml
118 lines (110 loc) · 2.41 KB
/
database-mysql.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
apiVersion: apps/v1
kind: StatefulSet
metadata:
namespace: monitoring
name: mysql-server
labels:
app: mysql-server
spec:
replicas: 1
selector:
matchLabels:
app: mysql-server
serviceName: mysql-server
template:
metadata:
labels:
app: mysql-server
spec:
containers:
- image: mysql:8.0.19
name: mysql-server
args:
- "--default-authentication-plugin=mysql_native_password"
- --character-set-server=utf8
- --collation-server=utf8_bin
env:
- name: MYSQL_ROOT_PASSWORD
valueFrom:
secretKeyRef:
name: zabbix-app
key: MYSQL_ROOT_PASSWORD
- name: MYSQL_DATABASE
valueFrom:
configMapKeyRef:
key: MYSQL_DATABASE
name: zabbix-app
- name: MYSQL_USER
valueFrom:
secretKeyRef:
name: zabbix-app
key: MYSQL_USER
- name: MYSQL_PASSWORD
valueFrom:
secretKeyRef:
name: zabbix-app
key: MYSQL_PASSWORD
ports:
- containerPort: 3306
name: mysql-server
volumeMounts:
- name: mysql-persistent-storage
mountPath: /var/lib/mysql
volumes:
- name: mysql-persistent-storage
persistentVolumeClaim:
claimName: mysql-pv-claim
---
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
name: manual
namespace: monitoring
provisioner: docker.io/hostpath
reclaimPolicy: Retain
---
kind: PersistentVolume
apiVersion: v1
metadata:
namespace: monitoring
name: mysql-pv-volume
labels:
type: local
app: mysql-server
spec:
storageClassName: manual
capacity:
storage: 5Gi
accessModes:
- ReadWriteOnce
hostPath:
path: /data/mysql
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
namespace: monitoring
name: mysql-pv-claim
labels:
app: mysql-server
spec:
storageClassName: manual
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 5Gi
---
apiVersion: v1
kind: Service
metadata:
namespace: monitoring
name: mysql-server
labels:
app: mysql-server
spec:
type: ClusterIP
ports:
- port: 3306
selector:
app: mysql-server