-
Notifications
You must be signed in to change notification settings - Fork 1
/
04-galeraMariaDB.yaml
203 lines (200 loc) · 4.48 KB
/
04-galeraMariaDB.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
# ##### Mariadb Galera Cluster LoadBalancer Service #####
# ---
# apiVersion: v1
# kind: Service
# metadata:
# name: mariadb-lb
# labels:
# app: mariadb-lb
# namespace: kong-appgw
# spec:
# type: LoadBalancer
# loadBalancerSourceRanges:
# - 0.0.0.0/0
# ports:
# - name: mariadb-lb
# port: 13306
# targetPort: 3306
# protocol: TCP
# selector:
# app: mariadb
##### Mariadb Galera Cluster Service #####
---
apiVersion: v1
kind: Service
metadata:
name: mariadb
labels:
app: mariadb
namespace: kong-appgw
spec:
ports:
- port: 3306
name: mysql
clusterIP: None
selector:
app: mariadb
##### Mariadb Galera Cluster StatefulSet Template #####
---
apiVersion: apps/v1beta1
kind: StatefulSet
metadata:
name: mariadb
namespace: kong-appgw
spec:
serviceName: "mariadb"
replicas: 3
template:
metadata:
labels:
app: mariadb
spec:
containers:
- name: mariadb
image: labdocker/galara-mariadb:10.1
ports:
- name: mysql
containerPort: 3306
env:
- name: CLUSTER_NAME
valueFrom:
configMapKeyRef:
name: kong-configmap
key: galera_mariadb_cluster_name
- name: DISCOVERY_SERVICE
valueFrom:
configMapKeyRef:
name: kong-configmap
key: galera_mariadb_discovery_service
- name: MYSQL_ROOT_PASSWORD
valueFrom:
secretKeyRef:
name: kong-secrets
key: galera_mariadb_root_pass
- name: XTRABACKUP_PASSWORD
valueFrom:
secretKeyRef:
name: kong-secrets
key: galera_mariadb_xtrabackup_passwd
- name: MYSQL_DATABASE
valueFrom:
configMapKeyRef:
name: kong-configmap
key: galera_mariadb_db_name
- name: MYSQL_USER
valueFrom:
configMapKeyRef:
name: kong-configmap
key: galera_mariadb_user
- name: MYSQL_PASSWORD
valueFrom:
secretKeyRef:
name: kong-secrets
key: galera_mariadb_pass
readinessProbe:
exec:
command:
- /healthcheck.sh
- --readiness
initialDelaySeconds: 180
periodSeconds: 1
livenessProbe:
exec:
command:
- /healthcheck.sh
- --liveness
initialDelaySeconds: 210
periodSeconds: 1
volumeMounts:
- name: mysql-datadir
mountPath: /var/lib/mysql
volumeClaimTemplates:
- metadata:
name: mysql-datadir
annotations:
volume.beta.kubernetes.io/storage-class: gcp-storage
spec:
accessModes: [ "ReadWriteOnce" ]
# storageClassName: gcp-storage
resources:
requests:
storage: 10Gi
##### phpMyadmin Service #####
---
apiVersion: v1
kind: Service
metadata:
name: myadmin
labels:
app: myadmin
namespace: kong-appgw
spec:
ports:
- port: 80
name: mysql
clusterIP: None
selector:
app: myadmin
# ##### phpMyadmin external Service #####
# ---
# apiVersion: v1
# kind: Service
# metadata:
# name: myadmin-lb
# namespace: kong-appgw
# spec:
# type: LoadBalancer
# loadBalancerSourceRanges:
# - 0.0.0.0/0
# ports:
# - name: myadmin-lb-ui
# port: 80
# targetPort: 80
# protocol: TCP
# selector:
# app: myadmin
##### phpMyadmin #####
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: myadmin
namespace: kong-appgw
spec:
replicas: 2
template:
metadata:
name: myadmin
labels:
app: myadmin
spec:
containers:
- name: myadmin
image: phpmyadmin/phpmyadmin:latest
env:
- name: PMA_ARBITRARY
value: "1"
- name: PMA_HOST
valueFrom:
configMapKeyRef:
name: kong-configmap
key: galera_mariadb_host
- name: PMA_PORT
valueFrom:
configMapKeyRef:
name: kong-configmap
key: galera_mariadb_port
- name: PMA_USER
valueFrom:
configMapKeyRef:
name: kong-configmap
key: galera_mariadb_admin
- name: PMA_PASSWORD
valueFrom:
secretKeyRef:
name: kong-secrets
key: galera_mariadb_root_pass
ports:
- name: myadmin-ui
containerPort: 80
protocol: TCP