111 lines
2.8 KiB
YAML
111 lines
2.8 KiB
YAML
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: wordpress
|
|
labels:
|
|
app: wordpress
|
|
spec:
|
|
replicas: 1
|
|
selector:
|
|
matchLabels:
|
|
app: wordpress
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: wordpress
|
|
spec:
|
|
# Follow the successful nginx-nodeport pattern - prefer worker nodes only
|
|
affinity:
|
|
nodeAffinity:
|
|
preferredDuringSchedulingIgnoredDuringExecution:
|
|
- weight: 100
|
|
preference:
|
|
matchExpressions:
|
|
- key: node-role.kubernetes.io/control-plane
|
|
operator: DoesNotExist
|
|
containers:
|
|
# MariaDB database container
|
|
- name: mariadb
|
|
image: mariadb:10.11
|
|
ports:
|
|
- containerPort: 3306
|
|
env:
|
|
- name: MARIADB_ROOT_PASSWORD
|
|
value: "root123"
|
|
- name: MARIADB_DATABASE
|
|
value: "wordpress"
|
|
- name: MARIADB_USER
|
|
value: "wordpress"
|
|
- name: MARIADB_PASSWORD
|
|
value: "wp123"
|
|
resources:
|
|
requests:
|
|
memory: "64Mi"
|
|
cpu: "100m"
|
|
limits:
|
|
memory: "256Mi"
|
|
cpu: "300m"
|
|
livenessProbe:
|
|
exec:
|
|
command:
|
|
- mysqladmin
|
|
- ping
|
|
- -h
|
|
- localhost
|
|
- -u
|
|
- root
|
|
- -proot123
|
|
initialDelaySeconds: 30
|
|
periodSeconds: 30
|
|
readinessProbe:
|
|
exec:
|
|
command:
|
|
- mysqladmin
|
|
- ping
|
|
- -h
|
|
- localhost
|
|
- -u
|
|
- root
|
|
- -proot123
|
|
initialDelaySeconds: 15
|
|
periodSeconds: 15
|
|
|
|
# WordPress web application container
|
|
- name: wordpress
|
|
image: wordpress:latest
|
|
ports:
|
|
- containerPort: 80
|
|
env:
|
|
# Use container name for inter-container communication
|
|
- name: WORDPRESS_DB_HOST
|
|
value: "127.0.0.1"
|
|
- name: WORDPRESS_DB_NAME
|
|
value: "wordpress"
|
|
- name: WORDPRESS_DB_USER
|
|
value: "wordpress"
|
|
- name: WORDPRESS_DB_PASSWORD
|
|
value: "wp123"
|
|
- name: WORDPRESS_CONFIG_EXTRA
|
|
value: |
|
|
define('WP_MEMORY_LIMIT', '256M');
|
|
@ini_set('upload_max_filesize', '64M');
|
|
resources:
|
|
requests:
|
|
memory: "128Mi"
|
|
cpu: "200m"
|
|
limits:
|
|
memory: "512Mi"
|
|
cpu: "500m"
|
|
# Give WordPress much more time to initialize and connect to database
|
|
livenessProbe:
|
|
httpGet:
|
|
path: /wp-admin/install.php
|
|
port: 80
|
|
initialDelaySeconds: 180
|
|
periodSeconds: 45
|
|
readinessProbe:
|
|
httpGet:
|
|
path: /wp-admin/install.php
|
|
port: 80
|
|
initialDelaySeconds: 120
|
|
periodSeconds: 30 |