forked from ntheanh201/kodekloud-engineer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
solution.yaml
145 lines (145 loc) · 3.07 KB
/
solution.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
apiVersion: v1
kind: ConfigMap
metadata:
name: php-config
data:
php.ini: |
variables_order = "EGPCS"
---
apiVersion: v1
kind: Secret
metadata:
name: mysql-root-password
type: Opaque
data:
root: "cm9vdA=="
---
apiVersion: v1
kind: Secret
metadata:
name: mysql-user
type: Opaque
data:
user: "dXNlcg=="
pass: "cGFzcw=="
---
apiVersion: v1
kind: Secret
metadata:
name: mysql-db
type: Opaque
data:
host: "bXlzcWwtc2VydmljZQ=="
database: "bXlzcWxfZGF0YWJhc2U="
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: lamp-wp
labels:
app: lamp
spec:
replicas: 1
selector:
matchLabels:
app: lamp
template:
metadata:
name: lamp
labels:
app: lamp
spec:
containers:
- name: httpd-php-container
image: webdevops/php-apache:alpine-3-php7
volumeMounts:
- mountPath: /opt/docker/etc/php/php.ini
name: php-config
subPath: php.ini
imagePullPolicy: IfNotPresent
env:
- name: MYSQL_ROOT_PASSWORD
valueFrom:
secretKeyRef:
key: root
name: mysql-root-password
- name: MYSQL_DATABASE
valueFrom:
secretKeyRef:
key: database
name: mysql-db
- name: MYSQL_HOST
valueFrom:
secretKeyRef:
key: host
name: mysql-db
- name: MYSQL_USER
valueFrom:
secretKeyRef:
key: user
name: mysql-user
- name: MYSQL_PASSWORD
valueFrom:
secretKeyRef:
key: pass
name: mysql-user
- name: mysql-container
image: mysql:5.6
env:
- name: MYSQL_ROOT_PASSWORD
valueFrom:
secretKeyRef:
key: root
name: mysql-root-password
- name: MYSQL_DATABASE
valueFrom:
secretKeyRef:
key: database
name: mysql-db
- name: MYSQL_HOST
valueFrom:
secretKeyRef:
key: host
name: mysql-db
- name: MYSQL_USER
valueFrom:
secretKeyRef:
key: user
name: mysql-user
- name: MYSQL_PASSWORD
valueFrom:
secretKeyRef:
key: pass
name: mysql-user
volumes:
- name: php-config
configMap:
name: php-config
restartPolicy: Always
---
apiVersion: v1
kind: Service
metadata:
name: lamp-service
spec:
selector:
app: lamp
ports:
- protocol: TCP
port: 80
targetPort: 80
nodePort: 30008
type: NodePort
---
apiVersion: v1
kind: Service
metadata:
name: mysql-service
spec:
selector:
app: lamp
ports:
- protocol: TCP
port: 3306
targetPort: 3306
type: ClusterIP