Initial commit: k3s deployment configurations
This commit is contained in:
57
k3s/my-blog/02-wordpress.yaml
Normal file
57
k3s/my-blog/02-wordpress.yaml
Normal file
@@ -0,0 +1,57 @@
|
||||
# 02-wordpress.yaml
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: wordpress-service
|
||||
namespace: demo-space
|
||||
spec:
|
||||
ports:
|
||||
- port: 80
|
||||
selector:
|
||||
app: wordpress
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: wordpress
|
||||
namespace: demo-space
|
||||
spec:
|
||||
replicas: 2 # 我们启动 2 个 WordPress 前台
|
||||
selector:
|
||||
matchLabels:
|
||||
app: wordpress
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: wordpress
|
||||
spec:
|
||||
containers:
|
||||
- image: wordpress:latest
|
||||
name: wordpress
|
||||
env:
|
||||
- name: WORDPRESS_DB_HOST
|
||||
value: "mysql-service" # 魔法所在!直接填名字
|
||||
- name: WORDPRESS_DB_USER
|
||||
value: "wordpress"
|
||||
- name: WORDPRESS_DB_PASSWORD
|
||||
value: "wordpress"
|
||||
- name: WORDPRESS_DB_NAME
|
||||
value: "wordpress"
|
||||
- name: WORDPRESS_CONFIG_EXTRA
|
||||
value: |
|
||||
/* HTTPS behind reverse proxy - Complete configuration */
|
||||
if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https') {
|
||||
$_SERVER['HTTPS'] = 'on';
|
||||
}
|
||||
if (isset($_SERVER['HTTP_X_FORWARDED_HOST'])) {
|
||||
$_SERVER['HTTP_HOST'] = $_SERVER['HTTP_X_FORWARDED_HOST'];
|
||||
}
|
||||
/* Force SSL for admin */
|
||||
define('FORCE_SSL_ADMIN', true);
|
||||
/* Fix cookie issues */
|
||||
@ini_set('session.cookie_httponly', true);
|
||||
@ini_set('session.cookie_secure', true);
|
||||
@ini_set('session.use_only_cookies', true);
|
||||
ports:
|
||||
- containerPort: 80
|
||||
name: wordpress
|
||||
Reference in New Issue
Block a user