-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy-web-secret-vol-init-mysql.yml
53 lines (53 loc) · 1.38 KB
/
deploy-web-secret-vol-init-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
apiVersion: "apps/v1"
kind: "Deployment"
metadata:
name: "webserver"
spec:
replicas: 3
selector:
matchLabels:
app: "web"
template:
metadata:
labels:
app: "web"
spec:
initContainers:
- name: "homepage"
image: "eagle.example.com:5000/busybox:1.30.1"
command: ['sh','-c','sleep 10;echo $(hostname) >> /prepare/index.html']
volumeMounts:
- mountPath: "/prepare"
name: "webroot"
- name: "checkdb"
image: "eagle.example.com:5000/mysql:v2"
command: ['sh','-c',"until mysql -h dbserver-2.database -u root -p$DB_ROOT_PWD -e 'show status';do sleep 10;done"]
env:
- name: DB_ROOT_PWD
valueFrom:
secretKeyRef:
name: db-root-pwd
key: dbpwd
containers:
- name: "apache-frontend"
image: "eagle.example.com:5000/httpd:secure"
ports:
- containerPort: 80
env:
- name: DB_ROOT_PWD
valueFrom:
secretKeyRef:
name: db-root-pwd
key: dbpwd
volumeMounts:
- name: webenvvol
mountPath: /etc/httpd/conf.d
- name: webroot
mountPath: /var/www/html
volumes:
- name: webenvvol
configMap:
name: webenv
- name: webroot
persistentVolumeClaim:
claimName: webclaim