WordPress on Kubernetes β Infra & DevOps Assignment (Syfe) π Overview
This project demonstrates a production-grade WordPress deployment on Kubernetes using Docker, Helm, Nginx (OpenResty), Prometheus, and Grafana.
The goal of this assignment is to show:
Kubernetes fundamentals
Helm-based deployments
Reverse proxy configuration
Persistent storage
Monitoring and alerting
Practical DevOps troubleshooting
π Architecture Client | v Nginx (OpenResty + Lua) | v WordPress (Apache + PHP) | v MySQL (StatefulSet + Persistent Storage)
Monitoring stack:
Prometheus β Alertmanager β Grafana
π Project Structure wordpress-k8s-devops-syfe/ βββ docker/ β βββ nginx/ β βββ wordpress/ β βββ mysql/ β βββ helm/ β βββ wordpress/ β βββ Chart.yaml β βββ templates/ β βββ wordpress-deployment.yaml β βββ mysql-statefulset.yaml β βββ nginx-deployment.yaml β βββ services.yaml β βββ pv.yaml β βββ pvc.yaml β βββ monitoring/ β βββ prometheus/ β βββ alerts.yaml β βββ README.md
π§° Prerequisites
Docker Desktop (with Kubernetes enabled)
kubectl
Helm
Git
Windows PowerShell
π³ Docker Image Build (Custom Images) WordPress Image cd docker/wordpress docker build -t syfe-wordpress:1.0 .
Used for: Running WordPress with Apache + PHP inside Kubernetes.
MySQL Image cd docker/mysql docker build -t syfe-mysql:1.0 .
Used for: Persistent MySQL database (StatefulSet).
Nginx (OpenResty + Lua) cd docker/nginx docker build -t syfe-nginx-openresty:1.1 .
Used for: Reverse proxy in front of WordPress.
βΈ Kubernetes Cluster Verification kubectl get nodes kubectl get pods kubectl get services
Used for: Verifying cluster readiness.
π¦ Helm Deployment (Main Application) Install WordPress Stack helm install my-release helm/wordpress
Upgrade (after changes) helm upgrade my-release helm/wordpress
Verify Pods kubectl get pods
Cleanup helm delete my-release
β Application Verification (Correct Production Method)
Instead of browser-based verification, the app is validated inside the cluster.
kubectl exec -it deployment/nginx -- curl -I http://wordpress
Expected Output HTTP/1.1 302 Found Location: /wp-admin/install.php
This proves:
Nginx is running
WordPress is running
Apache & PHP are functional
MySQL connection works
Reverse proxy is correct
π Monitoring Setup (Prometheus & Grafana) Add Helm Repository helm repo add prometheus-community https://prometheus-community.github.io/helm-charts helm repo update
Install Monitoring Stack helm install monitoring prometheus-community/kube-prometheus-stack
Verify Monitoring Pods kubectl get pods -l release=monitoring
π Grafana Access Get Admin Password (Windows PowerShell) [System.Text.Encoding]::UTF8.GetString( [System.Convert]::FromBase64String( (kubectl get secret monitoring-grafana -o jsonpath="{.data.admin-password}") ) )
Port Forward Grafana kubectl port-forward svc/monitoring-grafana 3000:80
Access:
π Metrics Visualization Dashboards Used
Kubernetes / Compute Resources / Pod
Prometheus / Overview
Metrics include:
Pod CPU utilization
Pod memory usage
Kubernetes resource health
Note: Metrics may appear minimal on Windows Docker Desktop due to cAdvisor and node-exporter limitations.
π¨ Alerting Setup & Verification Check Loaded Alert Rules kubectl get prometheusrules
Open Alertmanager UI kubectl port-forward svc/monitoring-kube-prometheus-alertmanager 9093:9093
Access:
Test Alert (Always Firing β Verification Only) alert: TestAlwaysFiring expr: vector(1)
Applied using:
kubectl apply -f test-alert.yaml
Verified in Alertmanager UI.
Cleanup:
kubectl delete -f test-alert.yaml
β Known Limitations (Local Environment)
Running on Windows + Docker Desktop
node-exporter may crash
CPU graphs may appear empty
Port-forwarding may be unreliable
These are environment limitations, not application issues.
π§ Production Improvements
In a real production environment:
nginx-prometheus-exporter for request & 5xx metrics
mysqld-exporter for MySQL metrics
Ingress controller
TLS & HPA
External alert receivers (Slack, Email, PagerDuty)
β Assignment Completion Summary
β Docker images created β Kubernetes deployment β Helm-based install/upgrade/delete β Reverse proxy via Nginx β Persistent storage β Monitoring with Prometheus & Grafana β Alerting with Alertmanager β Proper verification & documentation
π€ Author
Abhinav Prakash Infra & DevOps Intern Candidate