-
-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy path09_wordpress.yml
171 lines (171 loc) · 3.54 KB
/
09_wordpress.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
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
164
165
166
167
168
169
170
171
apiVersion: v1
kind: Secret
metadata:
name: wordpress
stringData:
MYSQL_DATABASE: wordpress
MYSQL_PASSWORD: wordpress
MYSQL_ROOT_PASSWORD: somewordpress
MYSQL_USER: wordpress
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: mysql
spec:
serviceName: mysql
selector:
matchLabels:
project: wordpress
app: mysql
volumeClaimTemplates:
- metadata:
name: mysql
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
template:
metadata:
labels:
project: wordpress
app: mysql
spec:
containers:
- name: mysql
image: mysql:5.6
resources:
requests:
cpu: 50m
memory: 300Mi
env:
- name: MYSQL_DATABASE
valueFrom:
secretKeyRef:
name: wordpress
key: MYSQL_DATABASE
- name: MYSQL_PASSWORD
valueFrom:
secretKeyRef:
name: wordpress
key: MYSQL_PASSWORD
- name: MYSQL_ROOT_PASSWORD
valueFrom:
secretKeyRef:
name: wordpress
key: MYSQL_ROOT_PASSWORD
- name: MYSQL_USER
valueFrom:
secretKeyRef:
name: wordpress
key: MYSQL_USER
ports:
- containerPort: 3306
volumeMounts:
- mountPath: /var/lib/mysql
name: mysql
volumes:
- name: mysql
persistentVolumeClaim:
claimName: mysql
---
apiVersion: v1
kind: Service
metadata:
name: mysql
spec:
clusterIP: None
selector:
project: wordpress
app: mysql
ports:
- port: 3306
targetPort: 3306
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: wordpress
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: wordpress
spec:
selector:
matchLabels:
project: wordpress
app: wordpress
replicas: 1
template:
metadata:
labels:
project: wordpress
app: wordpress
spec:
containers:
- name: wordpress
image: wordpress
resources:
requests:
cpu: 50m
memory: 50Mi
env:
- name: WORDPRESS_DB_HOST
value: mysql:3306
- name: WORDPRESS_DB_PASSWORD
valueFrom:
secretKeyRef:
name: wordpress
key: MYSQL_PASSWORD
- name: WORDPRESS_DB_USER
valueFrom:
secretKeyRef:
name: wordpress
key: MYSQL_USER
ports:
- containerPort: 80
volumeMounts:
- mountPath: /var/www/html
name: wordpress
volumes:
- name: wordpress
persistentVolumeClaim:
claimName: wordpress
---
apiVersion: v1
kind: Service
metadata:
name: wordpress
spec:
type: NodePort
selector:
project: wordpress
app: wordpress
ports:
- port: 80
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: wordpress
spec:
rules:
- host: wordpress.127.0.0.1.nip.io
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: wordpress
port:
number: 80