forked from ganrad/k8s-springboot-data-rest
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy-app-persistent.yaml
163 lines (163 loc) · 3.09 KB
/
deploy-app-persistent.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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
---
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
name: managed-dev-mysql
provisioner: kubernetes.io/azure-disk
parameters:
storageaccounttype: Standard_LRS
kind: managed
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: azure-mgd-dsk-mysql
spec:
accessModes:
- ReadWriteOnce
storageClassName: managed-dev-mysql
resources:
requests:
storage: 5Gi
---
apiVersion: v1
kind: Secret
metadata:
name: mysql
type: Opaque
data:
database-name: c2FtcGxlZGI=
database-password: cGFzc3dvcmQ=
database-root-password: cGFzc3dvcmQ=
database-user: bXlzcWw=
---
kind: Service
apiVersion: v1
metadata:
name: mysql
spec:
selector:
app: mysql
ports:
- protocol: TCP
port: 3306
targetPort: 3306
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: mysql
labels:
app: mysql-persistent
spec:
replicas: 1
selector:
matchLabels:
app: mysql
template:
metadata:
labels:
app: mysql
spec:
containers:
- name: mysql
image: mysql/mysql-server:5.7.22
ports:
- containerPort: 3306
protocol: TCP
volumeMounts:
- mountPath: /var/lib/mysql
name: data-volume
subPath: mysql
env:
- name: MYSQL_USER
valueFrom:
secretKeyRef:
name: mysql
key: database-user
- name: MYSQL_PASSWORD
valueFrom:
secretKeyRef:
name: mysql
key: database-password
- name: MYSQL_ROOT_PASSWORD
valueFrom:
secretKeyRef:
name: mysql
key: database-root-password
- name: MYSQL_DATABASE
valueFrom:
secretKeyRef:
name: mysql
key: database-name
volumes:
- name: data-volume
persistentVolumeClaim:
claimName: azure-mgd-dsk-mysql
---
apiVersion: v1
kind: ConfigMap
metadata:
name: mysql-db-name
data:
mysqldb.properties: |
mysql.dbname=sampledb
---
apiVersion: v1
kind: Secret
metadata:
name: mysql-secret
type: Opaque
data:
username.properties: bXlzcWwudXNlcj1teXNxbAo=
password.properties: bXlzcWwucGFzc3dvcmQ9cGFzc3dvcmQK
---
kind: Service
apiVersion: v1
metadata:
name: po-service
spec:
type: LoadBalancer
selector:
app: po-service
ports:
- name: 80-tcp
protocol: TCP
port: 80
targetPort: 8080
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: po-service
labels:
app: po-service
spec:
replicas: 1
selector:
matchLabels:
app: po-service
template:
metadata:
labels:
app: po-service
spec:
volumes:
- name: mysqlcm
configMap:
name: mysql-db-name
- name: mysqlse
secret:
secretName: mysql-secret
containers:
- name: po-service
image: mtcslabtest.azurecr.io/po-service:latest
ports:
- containerPort: 8080
protocol: TCP
volumeMounts:
- name: mysqlcm
mountPath: /etc/config
- name: mysqlse
mountPath: /etc/vol-secrets
---