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.
While wp-k8s project is compatible with any Kubernetes/cloud provider:
For its private cloud implementation refer to:
For its public cloud implementation on GKE refer to:
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
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
- Blogpost: wp-k8s: WordPress on privately hosted Kubernetes cluster (Raspberry Pi 4 + Synology)
- Blogpost: wp-k8s - WordPress on Kubernetes (GKE, cloud SQL, NFS, cluster autoscaling, HPA, VPA, Ingress, Let's Encrypt)
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!
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.