-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathstatefulset.yaml
77 lines (77 loc) · 2.09 KB
/
statefulset.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
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: mariadb
spec:
serviceName: mariadb
replicas: 3
podManagementPolicy: Parallel
selector:
matchLabels:
app: mariadb
template:
metadata:
labels:
app: mariadb
spec:
initContainers:
- name: init-repl
image: mariadb
imagePullPolicy: Always
command:
- bash
- -c
- /mnt/repl/initContainer.sh
volumeMounts:
- name: repl
mountPath: /mnt/repl
- name: config
mountPath: /etc/mysql/conf.d/
- name: initdb
mountPath: /docker-entrypoint-initdb.d
restartPolicy: Always
containers:
- name: mariadb
image: mariadb
ports:
- containerPort: 3306
protocol: TCP
env:
- name: MYSQL_TCP_PORT
value: "3306"
- name: MARIADB_ROOT_PASSWORD
value: mariadb
# Not compatible with replication:
# Error 'Operation CREATE USER failed for 'mariadb'@'%'' on query. Default database: 'mysql'. Query: 'CREATE USER 'mariadb'@'%' IDENTIFIED BY 'mariadb''
# - name: MARIADB_DATABASE
# value: mariadb
# - name: MARIADB_USER
# value: mariadb
# - name: MARIADB_PASSWORD
# value: mariadb
- name: MYSQL_INITDB_SKIP_TZINFO
value: "1"
volumeMounts:
- name: storage
mountPath: /var/lib/mysql
- name: config
mountPath: /etc/mysql/conf.d/
- name: initdb
mountPath: /docker-entrypoint-initdb.d
volumes:
- name: repl
secret:
secretName: mariadb-repl
defaultMode: 0777
- name: config
emptyDir: {}
- name: initdb
emptyDir: {}
volumeClaimTemplates:
- metadata:
name: storage
spec:
accessModes: ["ReadWriteOnce"]
resources:
requests:
storage: 300M