-
Notifications
You must be signed in to change notification settings - Fork 0
/
wordpress-example.yaml
129 lines (129 loc) · 3.4 KB
/
wordpress-example.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
apiVersion: v1
kind: ConfigMap
metadata:
name: wordpress-example-nginx-conf
labels:
app: wordpress-example
data:
wordpress-example.conf: |
upstream php {
server localhost:9000;
}
server {
listen 80 default_server;
#server_name wordpress.example.com;
root /var/www/html;
index index.php;
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
include fastcgi_params;
fastcgi_intercept_errors on;
fastcgi_pass php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires max;
log_not_found off;
}
}
---
apiVersion: v1
kind: Secret
metadata:
name: wordpress-example-mysql
labels:
app: wordpress-example
stringData:
MYSQL_ROOT_PASSWORD: "SQL@root"
MYSQL_PASSWORD: "SQL@user"
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: wordpress-example-deployment
labels:
app: wordpress-example
spec:
replicas: 1
selector:
matchLabels:
app: wordpress-example
template:
metadata:
labels:
app: wordpress-example
spec:
containers:
- name: nginx
image: nginx:stable-alpine
volumeMounts:
- name: nginx-conf
mountPath: /etc/nginx/conf.d/
- name: wordpress-root
mountPath: /var/www/html
ports:
- containerPort: 80
- name: wordpress-php-fpm
image: wordpress:5.5.3-php7.3-fpm-alpine
env:
- name: WORDPRESS_DB_HOST
value: "127.0.0.1:3306"
- name: WORDPRESS_DB_USER
value: "wordpress"
- name: WORDPRESS_DB_NAME
value: "wordpress"
- name: WORDPRESS_DB_PASSWORD
valueFrom:
secretKeyRef:
name: wordpress-example-mysql
key: MYSQL_PASSWORD
volumeMounts:
- name: wordpress-root
mountPath: /var/www/html
- name: database
image: mariadb:10.5
env:
- name: MYSQL_DATABASE
value: "wordpress"
- name: MYSQL_USER
value: "wordpress"
- name: MYSQL_ROOT_PASSWORD
valueFrom:
secretKeyRef:
name: wordpress-example-mysql
key: MYSQL_ROOT_PASSWORD
- name: MYSQL_PASSWORD
valueFrom:
secretKeyRef:
name: wordpress-example-mysql
key: MYSQL_PASSWORD
volumeMounts:
- name: database-root
mountPath: /var/lib/mysql
volumes:
- name: nginx-conf
configMap:
name: wordpress-example-nginx-conf
- name: wordpress-root
hostPath:
path: /var/wordpress-example/wordpress-root
- name: database-root
hostPath:
path: /var/wordpress-example/wordpress-database
---
apiVersion: v1
kind: Service
metadata:
name: wordpress-example-service
labels:
app: wordpress-example
spec:
type: LoadBalancer
selector:
app: wordpress-example
ports:
- port: 80
targetPort: 80
protocol: TCP