A simple Drupal 8.9 site builder for Kubernetes
Deployment is current set to DEV environment, so if you are planning to use that on PRODUCTION environment, please check the YAML files and make the necessary changes
- MySQL manifest files
- Drupal manifest files
- SH script for easy deploy
I am using Microk8s for local Kubernetes environement. The YAML files should with all kind of K8s clusters, but scripts were made with microk8s.kubectl command.
To install Microk8s on your local environemt, please check: https://microk8s.io/
Modules enabled:
- CoreDNS
- ha-cluster
All APIs listed here. Kubernetes version is 1.22
https://kubernetes.io/docs/concepts/overview/kubernetes-api/
drupal/deployment.yml:apiVersion: apps/v1 drupal/storage.yml:apiVersion: v1 drupal/storage.yml:apiVersion: v1 drupal/namespace.yml:apiVersion: v1 drupal/service.yml:apiVersion: v1 mysql/deployment.yml:apiVersion: apps/v1 mysql/storage.yml:apiVersion: v1 mysql/storage.yml:apiVersion: v1 mysql/namespace.yml:apiVersion: v1 mysql/service.yml:apiVersion: v1
For this DEV environment, I am using local storage for PersistentVolumes, so no need of Storage Class. Please, don't use that in PRODUCTION.
To check Storage Classes, please see the following doc: https://kubernetes.io/docs/concepts/storage/storage-classes/#local
With Microk8s (or any other K8s cluster running), just run the following script file.
deploy-drupal.sh
It will do the following tasks:
- Site name (it will be the namespace on K8s and also your deployment main name);
- Port for Drupal (mapped local port for HTTP. Only for DEV);
- Secret for a Random MySQL Password;
- Deploy MySQL pod with some default settings;
- Deploy Drupal 8.9.20.
At the end of the deploy script, it will be an output with Drupal and Database informations:
===== DATABASE INFORMATION FOR DRUPAL SETUP =====
Database Name is : EXAMPLE-database
Database username is : root
Password is : EXAMPLE
Host MySQL is : EXAMPLE-mysql-service
MySQL Port is : 3306
Name | Version Number |
---|---|
K8s | 1.22 |
Drupal | 8.9.20 |
MySQL | 5.7.38 |
Just run the removal script for completely remove Drupal from your cluster. Just point to the correct sitename/namespace
remove-drupal.sh
DISCLAIMER: In my lab, I have put the local files on /storage path. If you are using a different path, please change this script.
If you want to contribute with this REPO somehow, please submit a pull request and I will kindly evaluate.