237 lines
6.4 KiB
YAML
237 lines
6.4 KiB
YAML
apiVersion: v1
|
|
kind: PersistentVolumeClaim
|
|
metadata:
|
|
name: wordpress-database-pvc
|
|
spec:
|
|
accessModes:
|
|
- ReadWriteOnce
|
|
resources:
|
|
requests:
|
|
storage: 5Gi
|
|
storageClassName: standard
|
|
|
|
---
|
|
apiVersion: v1
|
|
kind: PersistentVolumeClaim
|
|
metadata:
|
|
name: wordpress-content-pvc
|
|
spec:
|
|
accessModes:
|
|
- ReadWriteOnce
|
|
resources:
|
|
requests:
|
|
storage: 2Gi
|
|
storageClassName: standard
|
|
|
|
---
|
|
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: wordpress
|
|
labels:
|
|
app: wordpress
|
|
spec:
|
|
replicas: 1
|
|
selector:
|
|
matchLabels:
|
|
app: wordpress
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: wordpress
|
|
spec:
|
|
# Prefer worker nodes only (not master nodes) - following nginx-nodeport pattern
|
|
affinity:
|
|
nodeAffinity:
|
|
preferredDuringSchedulingIgnoredDuringExecution:
|
|
- weight: 100
|
|
preference:
|
|
matchExpressions:
|
|
- key: node-role.kubernetes.io/control-plane
|
|
operator: DoesNotExist
|
|
- weight: 50
|
|
preference:
|
|
matchExpressions:
|
|
- key: node-role.kubernetes.io/master
|
|
operator: DoesNotExist
|
|
containers:
|
|
# WordPress container (PHP + Apache)
|
|
- name: wordpress
|
|
image: wordpress:6.4-php8.2-apache
|
|
ports:
|
|
- containerPort: 80
|
|
name: wordpress
|
|
env:
|
|
- name: WORDPRESS_DB_HOST
|
|
value: "localhost"
|
|
- name: WORDPRESS_DB_NAME
|
|
value: "wordpress"
|
|
- name: WORDPRESS_DB_USER
|
|
value: "wordpress"
|
|
- name: WORDPRESS_DB_PASSWORD
|
|
value: "mycelium-secure-password-2025"
|
|
- name: WORDPRESS_CONFIG_EXTRA
|
|
value: |
|
|
define('DISALLOW_FILE_EDIT', true);
|
|
define('FORCE_SSL_ADMIN', false);
|
|
define('WP_MEMORY_LIMIT', '256M');
|
|
define('WP_MAX_MEMORY_LIMIT', '256M');
|
|
@ini_set('upload_max_filesize', '64M');
|
|
@ini_set('post_max_size', '64M');
|
|
@ini_set('max_execution_time', 300);
|
|
volumeMounts:
|
|
- name: wordpress-content
|
|
mountPath: /var/www/html
|
|
- name: wordpress-config
|
|
mountPath: /var/www/html/wp-config.php
|
|
subPath: wp-config.php
|
|
- name: wordpress-config
|
|
mountPath: /etc/apache2/conf-available/wordpress.conf
|
|
subPath: wordpress.conf
|
|
- name: init-wordpress
|
|
mountPath: /init-wordpress.sh
|
|
subPath: init-wordpress.sh
|
|
resources:
|
|
requests:
|
|
memory: "128Mi"
|
|
cpu: "200m"
|
|
limits:
|
|
memory: "512Mi"
|
|
cpu: "500m"
|
|
livenessProbe:
|
|
httpGet:
|
|
path: /
|
|
port: 80
|
|
initialDelaySeconds: 60
|
|
periodSeconds: 30
|
|
readinessProbe:
|
|
httpGet:
|
|
path: /
|
|
port: 80
|
|
initialDelaySeconds: 30
|
|
periodSeconds: 10
|
|
|
|
# MariaDB container (database)
|
|
- name: mariadb
|
|
image: mariadb:10.11
|
|
ports:
|
|
- containerPort: 3306
|
|
name: mariadb
|
|
env:
|
|
- name: MARIADB_ROOT_PASSWORD
|
|
value: "mycelium-root-password-2025"
|
|
- name: MARIADB_DATABASE
|
|
value: "wordpress"
|
|
- name: MARIADB_USER
|
|
value: "wordpress"
|
|
- name: MARIADB_PASSWORD
|
|
value: "mycelium-secure-password-2025"
|
|
- name: MARIADB_CHARACTER_SET
|
|
value: "utf8mb4"
|
|
- name: MARIADB_COLLATION
|
|
value: "utf8mb4_unicode_ci"
|
|
volumeMounts:
|
|
- name: mariadb-database
|
|
mountPath: /var/lib/mysql
|
|
- name: mariadb-config
|
|
mountPath: /etc/mysql/conf.d/my.cnf
|
|
subPath: my.cnf
|
|
resources:
|
|
requests:
|
|
memory: "64Mi"
|
|
cpu: "100m"
|
|
limits:
|
|
memory: "256Mi"
|
|
cpu: "300m"
|
|
livenessProbe:
|
|
exec:
|
|
command:
|
|
- mysqladmin
|
|
- ping
|
|
- -h
|
|
- localhost
|
|
- -u
|
|
- root
|
|
- -p"mycelium-root-password-2025"
|
|
initialDelaySeconds: 60
|
|
periodSeconds: 30
|
|
readinessProbe:
|
|
exec:
|
|
command:
|
|
- mysqladmin
|
|
- ping
|
|
- -h
|
|
- localhost
|
|
- -u
|
|
- root
|
|
- -p"mycelium-root-password-2025"
|
|
initialDelaySeconds: 30
|
|
periodSeconds: 10
|
|
|
|
initContainers:
|
|
# Init container to initialize MariaDB
|
|
- name: init-mariadb
|
|
image: mariadb:10.11
|
|
command: ["/bin/sh", "-c"]
|
|
args:
|
|
- |
|
|
echo "🔧 Starting MariaDB initialization..."
|
|
chmod +x /init-mariadb.sh
|
|
/init-mariadb.sh
|
|
echo "✅ MariaDB initialization complete"
|
|
volumeMounts:
|
|
- name: mariadb-config
|
|
mountPath: /etc/mysql/conf.d/my.cnf
|
|
subPath: my.cnf
|
|
- name: mariadb-init
|
|
mountPath: /init-mariadb.sh
|
|
subPath: init-mariadb.sh
|
|
|
|
# Init container to initialize WordPress
|
|
- name: init-wordpress
|
|
image: wordpress:6.4-php8.2-apache
|
|
command: ["/bin/sh", "-c"]
|
|
args:
|
|
- |
|
|
echo "🔧 Starting WordPress initialization..."
|
|
sleep 30
|
|
chmod +x /init-wordpress.sh
|
|
/init-wordpress.sh
|
|
echo "✅ WordPress initialization complete"
|
|
volumeMounts:
|
|
- name: wordpress-content
|
|
mountPath: /var/www/html
|
|
- name: wordpress-config
|
|
mountPath: /var/www/html/wp-config.php
|
|
subPath: wp-config.php
|
|
- name: init-wordpress
|
|
mountPath: /init-wordpress.sh
|
|
subPath: init-wordpress.sh
|
|
|
|
volumes:
|
|
- name: wordpress-config
|
|
configMap:
|
|
name: wordpress-config
|
|
- name: mariadb-config
|
|
configMap:
|
|
name: wordpress-mariadb-config
|
|
- name: mariadb-init
|
|
configMap:
|
|
name: wordpress-mariadb-config
|
|
items:
|
|
- key: init-mariadb.sh
|
|
path: init-mariadb.sh
|
|
mode: 0755
|
|
- name: init-wordpress
|
|
configMap:
|
|
name: wordpress-config
|
|
items:
|
|
- key: init-wordpress.sh
|
|
path: init-wordpress.sh
|
|
mode: 0755
|
|
- name: mariadb-database
|
|
persistentVolumeClaim:
|
|
claimName: wordpress-database-pvc
|
|
- name: wordpress-content
|
|
persistentVolumeClaim:
|
|
claimName: wordpress-content-pvc |