-
Notifications
You must be signed in to change notification settings - Fork 1
/
percona.yaml
129 lines (128 loc) · 3.26 KB
/
percona.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
kind: ConfigMap
apiVersion: v1
metadata:
name: percona-config
data:
mysql-root-password: "JdUDnZyTsL"
discovery-service: "etcd-client:2379"
cluster-name: "k8scluster"
xtrabackup-password: "p9jwtcv3WX"
mysql-proxy-user: "proxyuser"
mysql-proxy-password: "XTg1o9g8aP"
---
apiVersion: v1
kind: ReplicationController
metadata:
name: pxc-rc
spec:
replicas: 3 # tells deployment to run N pods matching the template
selector:
app: pxc-app
template: # create pods using pod definition in this template
metadata:
name: pxc
labels:
app: pxc-app
spec:
containers:
- name: percona-xtradb-cluster
image: perconalab/percona-xtradb-cluster:5.7
imagePullPolicy: Always
ports:
- containerPort: 3306
- containerPort: 4567
- containerPort: 4568
env:
- name: MYSQL_ROOT_PASSWORD
valueFrom:
configMapKeyRef:
name: percona-config
key: mysql-root-password
- name: DISCOVERY_SERVICE
valueFrom:
configMapKeyRef:
name: percona-config
key: discovery-service
- name: CLUSTER_NAME
valueFrom:
configMapKeyRef:
name: percona-config
key: cluster-name
- name: XTRABACKUP_PASSWORD
valueFrom:
configMapKeyRef:
name: percona-config
key: xtrabackup-password
volumeMounts:
- name: mysql-persistent-storage
mountPath: /var/lib/mysql
volumes:
- name: mysql-persistent-storage
emptyDir: {}
---
apiVersion: v1
kind: ReplicationController
metadata:
name: proxysql-rc
spec:
replicas: 1 # tells deployment to run N pods matching the template
selector:
front: proxysql
template: # create pods using pod definition in this template
metadata:
name: proxysql
labels:
front: proxysql
spec:
containers:
- name: proxysql
image: amnk/proxysql:1.2.2
imagePullPolicy: Always
ports:
- containerPort: 3306
- containerPort: 6032
env:
- name: MYSQL_ROOT_PASSWORD
valueFrom:
configMapKeyRef:
name: percona-config
key: mysql-root-password
- name: DISCOVERY_SERVICE
valueFrom:
configMapKeyRef:
name: percona-config
key: discovery-service
- name: CLUSTER_NAME
valueFrom:
configMapKeyRef:
name: percona-config
key: cluster-name
- name: MYSQL_PROXY_USER
valueFrom:
configMapKeyRef:
name: percona-config
key: mysql-proxy-user
- name: MYSQL_PROXY_PASSWORD
valueFrom:
configMapKeyRef:
name: percona-config
key: mysql-proxy-password
---
apiVersion: v1
kind: Service
metadata:
name: pxc-service
labels:
app: pxc-app
spec:
ports:
# the port that this service should serve on
- port: 3306
targetPort: 3306
name: "mysql"
- port: 6032
targetPort: 6032
name: "proxyadm"
# label keys and values that must match in order to receive traffic for this service
selector:
front: proxysql