This repository consists of various Kubernetes deployments (see below for full info) which aim to seamlessly deploy production ready WordPress on both public and private cloud with autoscaling capabilities with minimum to no ops tasks. If you're interested in same type of setup without K8s, please refer to my containerized-wordpress-project.
While wp-k8s project is compatible with any Kubernetes/cloud provider:
- wp-k8s: WordPress on privately hosted Kubernetes cluster (Raspberry Pi 4 + Synology) or
- rpi-microk8s-bootstrap: Automate RPI device conversion into Kubernetes cluster nodes with Terraform blog post
- rpi-microk8s-bootstrap Github project
- wp-cloud-run: Ultimate WordPress setup on (GCP) Cloud Run blog post or its:
- wp-cloud-run 14 video Youtube playlist.
By Default, kustomization.yaml - will create all necessary secrets and make necessary deployments. See its contents for which deployments to enable based on which cloud (private or public) is targeted.
Contents of this file can be deployed by running: kubectl apply -k ./
- metallb-ingress-service.yaml – explained as part of Step 4.8
- mysql-cluster.yaml - to be used only if you’re not using Synology MariaDB or Cloud SQL database and want to create MySQL cluster as part of k8s cluster. See HowTo Create MySQL Cluster using mysql-operator section for more info.
- nfs.yaml - will utilize NFS server container image for Kubernetes, explained as part of Problem 3.3.
- nfs-synology.yaml – Explained as part of Step 5: Configure NFS on Synology
- wordpress-deployment.yaml – will create WordPress deployment using (official WordPress docker image) and its service. It will pick up secrets & variables set as part of “kustomization.yaml” file. Deployment will utilize our previously created NFS PVC. As part of a ConfigMap, various changes which to allow upload of size up 64MB. Which will fix problems of not being able to upload large files due to their file size or image dimension.
- ingress.yaml with ingress-nginx controller which will serve as our load balancer. This will be our only entry point to our cluster from outside world on port 443 (any traffic on port 80 will be redirected to 443).
- cluster-issuer.yaml Explained as part of Step 6.5
- cluster-issuer-staging.yaml Explaiend as part of Step 6.5
- vpa.yaml – will create VPA whose function has been described in wp-k8s: WordPress on Kubernetes project) section.
- hpa.yaml – will create HPA whose function has been described in wp-k8s: WordPress on Kubernetes project
- stateless-sa-sec.yaml - Will create Kubernetes secret named
wp-stateless-media-secret
for use as part of WP-Stateless (Google Cloud Storage) WordPress plugin. Make sure changes are made accordingly to wordpress-deployment.yaml file wherestateless-sa-sec.yaml
is referenced. Referenced as part of Step 3.1 & Step 5
If you don't have an existing MySQL database server, you can create MySQL cluster using MySQL operator.
helm repo add bitpoke https://helm-charts.bitpoke.io
helm install mysql-operator bitpoke/mysql-operator
Replace every "redacted" value as part of mysql-cluster.yaml with base64 encoded value, i.e:
echo -n 'mysql-password-value' | base64
YlhsemNXd3RjR0Z6YzNkdmNtUT0K
Followed by: kubectl apply -f mysql-cluster.yaml
After couple of minutes your MySQL cluster will be up and running. For more informaiton refer to: MySQL Operator - Deploy Cluster page
- wp-k8s: WordPress on privately hosted Kubernetes cluster (Raspberry Pi 4 + Synology) blog post
- wp-k8s - WordPress on Kubernetes (GKE, cloud SQL, NFS, cluster autoscaling, HPA, VPA, Ingress, Let's Encrypt) blog post
- rpi-microk8s-bootstrap: Automate RPI device conversion into Kubernetes cluster nodes with Terraform blog post
If you found this project useful, show your support and appreciation by donating or contributing code. Otherwise, giving credits and acknowledgments also goes a long way.
If wp-k8s helped you out and you find it useful, show your appreciation by donating (any amount) to the project!
Become a sponsor to Adnan Hodzic on Github to acknowledge my efforts and help project's further open source development.
bc1qlncmgdjyqy8pe4gad4k2s6xtyr8f2r3ehrnl87
Other ways of supporting the project consists of making a code or documentation contribution. If you have an idea for a new features or want to implement some of the existing feature requests or fix some of the bugs & issues. Please make your changes and submit a pull request which I'll be glad to review. If your changes are accepted you'll be credited for your contiribution.