-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathmysql-master.yml
92 lines (92 loc) · 2.6 KB
/
mysql-master.yml
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
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: mysql-master
labels:
app: mysql-master
component: mysql
spec:
serviceName: svc-mysql
podManagementPolicy: Parallel # Default is OrderedReady
replicas: 1 # Default is 1
selector:
matchLabels:
app: mysql-master # Has to match .spec.template.metadata.labels
component: mysql
template:
metadata:
labels:
app: mysql-master # Has to match .spec.selector.matchLabels
component: mysql
spec:
terminationGracePeriodSeconds: 10
containers:
- name: mysql
# image: mysql:latest
image: khteh/mysql-master:latest
imagePullPolicy: Always
# command: ["mysqld"]
# args: ["--lower_case_table_names=1", "--skip-ssl", "--ignore-db-dir=lost+found"]
lifecycle:
postStart:
exec:
command: ["/usr/local/bin/server-id.sh"]
env:
# - name: MYSQL_ALLOW_EMPTY_PASSWORD
# value: "1"
- name: MYSQL_REPLICATION_PASSWORD
valueFrom:
secretKeyRef:
name: mysql-secret
key: mysql-replication-password
- name: MYSQL_REPLICATION_USER
valueFrom:
secretKeyRef:
name: mysql-secret
key: mysql-replication-user
- name: MYSQL_ROOT_HOST
valueFrom:
secretKeyRef:
name: mysql-secret
key: mysql-root-host
- name: MYSQL_ROOT_PASSWORD
valueFrom:
secretKeyRef:
name: mysql-secret
key: mysql-root-password
- name: MYSQL_USER
valueFrom:
secretKeyRef:
name: mysql-secret
key: mysql-user
- name: MYSQL_PASSWORD
valueFrom:
secretKeyRef:
name: mysql-secret
key: mysql-password
- name: MYSQL_DATABASE
value: AspNetCoreWebApi
- name: MYSQL_DATABASE_1
value: library
ports:
- containerPort: 3306
name: mysql
volumeMounts:
- name: mysql-master-persistent-storage
mountPath: /var/lib/mysql
subPath: mysql
- name: mysql-initdb
mountPath: /docker-entrypoint-initdb.d
volumes:
- name: mysql-initdb
configMap:
name: mysql-initdb
volumeClaimTemplates:
- metadata:
name: mysql-master-persistent-storage
spec:
accessModes: [ "ReadWriteOnce" ]
# storageClassName: local-storage
resources:
requests:
storage: 2Gi