This repository contains Kubernetes YAML configuration files for deploying WordPress and MySQL with persistent storage in a Kubernetes cluster.
- Description: Defines a PersistentVolume (PV) for MySQL data storage.
- Namespace:
<your-namespace>
- Capacity: 3Gi
- AccessMode:
ReadWriteOnce
- StorageClass:
local-path
- HostPath:
/mnt/data
- Description: Contains updates or changes made to the
PV.yaml
over time.
- Description: Defines a PersistentVolumeClaim (PVC) for MySQL data.
- Namespace:
<your-namespace>
- Requested Storage: 1Gi
- AccessMode:
ReadWriteOnce
- StorageClass:
local-path
- Description: Contains updates or changes made to the
PVC.yaml
.
- Description: Deployment configuration for the MySQL database.
- Namespace:
<your-namespace>
- MySQL Version:
8.0
- Environment Variables: Populated from
mysql-secret
andwordpress-config
. - Volumes: Mounts the
mysql-data
PersistentVolumeClaim.
- Description: Contains updates or changes made to
mysql-deployment.yaml
.
- Description: Kubernetes Secret configuration for MySQL credentials (root password and username).
- Namespace:
<your-namespace>
- Data: Base64-encoded credentials for
MYSQL_ROOT_PASSWORD
andMYSQL_ROOT_USER
.
- Description: Instructions or updates regarding the creation or modification of
mysql-secret.yaml
.
- Description: Service configuration for MySQL database.
- Namespace:
<your-namespace>
- Service Type:
ClusterIP
- Port: Exposes MySQL on port
3306
.
- Description: Deployment configuration for WordPress.
- Namespace:
<your-namespace>
- WordPress Version:
6.3.1
with PHP 8.1. - Environment Variables: Database connection information is set using secrets and ConfigMaps.
- Volumes: Mounts the
wordpress-data
PersistentVolumeClaim.
- Description: Instructions or updates for the creation or modification of
wordpress-deployment.yaml
.
- Description: Nginx Ingress configuration for routing external traffic to WordPress.
- Namespace:
<your-namespace>
- Host:
yourdomain-name.com
- Service: Routes traffic to
wordpress-service
on port80
.
- Description: Updates or modifications to the
Ingress.yaml
.
- Description: Service configuration for WordPress.
- Namespace:
<your-namespace>
- Service Type:
ClusterIP
- Port: Exposes WordPress on port
80
.
- Description: Updates or modifications to
wordpress-service.yaml
.
To deploy the resources in a Kubernetes cluster:
-
Ensure you have a running Kubernetes cluster and
kubectl
configured. -
Apply the files in the following order:
kubectl apply -f mysql-secret.yaml kubectl apply -f PV.yaml kubectl apply -f PVC.yaml kubectl apply -f mysql-deployment.yaml kubectl apply -f mysql-service.yaml kubectl apply -f wordpress-deployment.yaml kubectl apply -f wordpress-service.yaml kubectl apply -f Ingress.yaml