Skip to content

Latest commit

 

History

History

README.md

📝 WordPress

WordPress + MariaDB stack running in k3s — previously used to serve mortylabs.com and andrewmorty.com. No longer actively deployed but retained as a reference for running WordPress on Kubernetes.

WordPress MariaDB NFS

⚠️ Not currently deployed — retained as a reference implementation. The Morty Labs website has since migrated to a Hugo static site on k3s.


📁 Files

File Description
pv_mariadb.yaml PersistentVolume + PVC for MariaDB (NFS-backed, 500M)
pv_wordpress.yaml PersistentVolume + PVC for WordPress (NFS-backed, 300M)
secrets.yaml MariaDB root password — ⚠️ never commit real values
svc_maria.yaml ClusterIP service for MariaDB (internal only)
svc_wordpress.yaml ClusterIP service for WordPress frontend
deployment_maria.yaml MariaDB deployment with resource limits
deployment_wordpress.yaml WordPress deployment with liveness/readiness probes
ingress.yaml Ingress — multi-domain TLS via cert-manager

✅ Prerequisites

Install k3s, MetalLB, ingress-nginx, and NFS provisioner first — see the root README.

1. Create the namespace:

kubectl create namespace wordpress

2. Edit pv_mariadb.yaml and pv_wordpress.yaml — set your NFS server IP and paths.

3. Edit secrets.yaml — set a strong password and add to .gitignore:

echo "**/secrets.yaml" >> ../../.gitignore

4. Edit ingress.yaml — replace mortylabs.com and andrewmorty.com with your domains.


🚀 Deploy

kubectl create namespace wordpress
kubectl apply -f pv_mariadb.yaml
kubectl apply -f pv_wordpress.yaml
kubectl apply -f secrets.yaml
kubectl apply -f svc_maria.yaml
kubectl apply -f svc_wordpress.yaml
kubectl apply -f deployment_maria.yaml
kubectl apply -f deployment_wordpress.yaml
kubectl apply -f ingress.yaml

kubectl rollout status deploy/wordpress-mariadb -n wordpress
kubectl rollout status deploy/wordpress -n wordpress

🔍 Verify

# Pods running?
kubectl get pods -n wordpress

# Services up?
kubectl get svc -n wordpress

# TLS certificate issued?
kubectl get certificate -n wordpress

# Site reachable?
curl -I https://mortylabs.com

📝 Notes

  • WordPress and MariaDB run in a dedicated wordpress namespace
  • MariaDB is ClusterIP only — not exposed outside the cluster
  • Resource limits set on both deployments — important on a Pi 4 with limited RAM
  • Liveness/readiness probes on /wp-login.php — gives WordPress time to start (60s delay)
  • strategy: Recreate on both deployments — avoids two instances trying to write to the same NFS volume simultaneously
  • restartPolicy removed from both Deployments — only valid on bare Pods