-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmysql.yml
60 lines (58 loc) · 1.33 KB
/
mysql.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
apiVersion: apps/v1
kind: Deployment
metadata:
name: mysql-deployment
namespace: ns-test
labels:
app: mysql
spec:
selector:
matchLabels:
app: mysql
replicas: 1
template:
metadata:
labels:
app: mysql
spec:
containers:
- name: mysql
image: mariadb
env:
- name: MYSQL_DATABASE
value: "testdb"
# kubectl create secret generic mysql-secrets --from-literal=rootpw=secret123 --namespace ns-test
- name: MYSQL_ROOT_PASSWORD
valueFrom:
secretKeyRef:
name: mysql-secrets
key: rootpw
ports:
- containerPort: 3306
volumeMounts:
- name: "mysql-schema"
mountPath: "/docker-entrypoint-initdb.d"
- name: mysql-volume
mountPath: "/var/lib/mysql"
volumes:
- name: mysql-volume
persistentVolumeClaim:
claimName: mysql-volume-claim
- name: mysql-schema
hostPath:
# minikube mount $PWD/mysql-init:/mysql-init/
path: "/mysql-init"
---
apiVersion: v1
kind: Service
metadata:
name: mysql-service
namespace: ns-test
labels:
app: mysql
spec:
type: ClusterIP
ports:
- port: 3306
selector:
app: mysql