-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeployPV.yaml
44 lines (44 loc) · 1.36 KB
/
deployPV.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
apiVersion: v1 # Create Secret object for password
kind: Secret
metadata:
name: mysqlsecret
type: Opaque
stringData:
password: P@ssw0rd!
---
apiVersion: apps/v1
kind: Deployment # Deployment
metadata:
name: mysqldeployment
labels:
app: mysql
spec:
replicas: 1
selector:
matchLabels:
app: mysql # select deployment container (template > metadata > labels)
strategy:
type: Recreate
template:
metadata:
labels:
app: mysql
spec:
containers:
- name: mysql
image: mysql
ports:
- containerPort: 3306
volumeMounts: # VolumeMounts on path and volume name
- mountPath: "/var/lib/mysql"
name: mysqlvolume # which volume to select (volumes > name)
env:
- name: MYSQL_ROOT_PASSWORD
valueFrom: # get mysql password from secrets
secretKeyRef:
name: mysqlsecret
key: password
volumes:
- name: mysqlvolume # name of Volume
persistentVolumeClaim:
claimName: mysqlclaim # chose/select "mysqlclaim" PVC that is defined above.