This project provides a complete setup for deploying a production-grade WordPress application on Kubernetes using Helm. It includes custom Docker images for WordPress, MySQL, and Nginx. Using Helm charts for managing Kubernetes resources.
- Docker
- Minikube
- Helm
-
Build the WordPress Docker image:
cd ../wordpress docker build -t your-dockerhub-username/wordpress .
-
Build the MySQL Docker image:
cd ../mysql docker build -t your-dockerhub-username/mysql .
-
Build the Nginx Docker image:
cd ../nginx docker build -t your-dockerhub-username/nginx .
-
Push the images to Docker Hub:
docker push your-dockerhub-username/wordpress docker push your-dockerhub-username/mysql docker push your-dockerhub-username/nginx
Update the values.yaml
files for each Helm chart with the appropriate Docker image repositories and tags.
-
Deploy MySQL
cd helm-charts/mysql helm install mysql .
-
Deploy WordPress:
cd ../wordpress helm install wordpress .
-
Deploy Nginx:
cd ../nginx helm install nginx .
-
Check Pods:
kubectl get pods
-
Check services:
kubectl get svc
-
Access wordpress:
minikube ip
helm delete mysql
helm delete wordpress
helm delete nginx
- Add the Prometheus Helm repository:
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts helm repo update
- Create a namespace for monitoring:
kubectl create namespace monitoring
- Deploy Prometheus:
helm install prometheus prometheus-community/prometheus -f ./monitoring/prometheus/values.yaml
- Add the Grafana Helm repository:
helm repo add grafana https://grafana.github.io/helm-charts helm repo update
- Deploy Prometheus:
helm install grafana grafana/grafana -n monitoring
- Get the Grafana admin password:
kubectl get secret --namespace monitoring grafana -o jsonpath="{.data.admin-password}" | base64 --decode ; echo
- Access Grafana:
Open the Grafana URL in your browser and log in with the username admin and the password obtained in the previous step.
kubectl get svc -n monitoring
Import predefined dashboards for MySQL, Nginx, and WordPress:
Go to Create > Import. Use the following dashboard IDs to import: MySQL: 7362 Nginx: 2135 WordPress: Create a custom dashboard with relevant metrics.