Launching Content Management System(Joomla) using AWS-EKS
AWS-EKS(Elastic Kubernetes Service) is a powerful Kubernetes management infrastructure that helps make it easier to run Kubernetes on AWS.
Joomla is a free and open-source content management system for publishing web content, developed by Open Source Matters, Inc. It is built on a model–view–controller web application framework that can be used independently of the CMS
First of all, we required an EKS cluster for deploying our project. So, let's start with creating the EKS cluster.
Creating an EKS cluster:
We will create a file named cluster1.yml which has all of the code required to create the EKS cluster. In this cluster, we will create three nodes(slaves) of the t2.micro instance. Adding ssh key so that later we can log in to these nodes for the management.
Run this command to run this file:
$ eksctl create cluster -f cluster1.yml
Now, the EKS cluster is created successfully.
Configuring kubectl command:
After that, we required to configure the kubectl command for the launched cluster(in my case cluster name is mycluster).
$ aws eks update-kubeconfig --name mycluster
Now, we required to install Amazon EFS Utilities on every node in the cluster using the following command:
$ yum install amazon-efs-utils
Create a namespace for our project:
Let’s create a namespace named webns where we will create all of our project deployments.
$ kubectl create namespace webns
Create an EFS storage:
We have to store the data and configurations of our project permanently. For this purpose, AWS provides us one scalable and elastic storage known as EFS.
Create an EFS storage from the AWS console and make sure to attach the correct security group as that of the EKS cluster.
EFS storage is created!
Create an EFS provisioner:
After that, we have to create EFS provisioner so that the EFS storage can be used by the resources in the EKS cluster.
The code for creating an EFS provisioner is written in a create-efs-provisioner.yaml file. Just replace the EFS file system ID at line no. 22 and replace the nfs server at line no. 33 with the values of your EFS file system.
Run the create-efs-provisioner.yaml file in a webns namespace to create an EFS provisioner.
$ kubectl create -f create-efs-provisioner.yaml -n webns
Now, we required to create Role-Based access control(RBAC). We are giving the role as cluster admin.
This can be done by running the create-rbac.yaml file in webns namespace.
$ kubectl create -f create-rbac.yaml -n webns
Create Storage Class, PVC for Joomla and PVC for MySQL:
We are creating the storage class and taking the storage from EFS storage we had created earlier.
Run the create-storage.yaml file to create the Storage Class, PVC for Joomla, and PVC for MySQL.
$ kubectl create -f create-storage.yaml -n webns
Now, all of the resources required to run our Content Management System(Joomla) are created.
As a final step, we required to create the MySQL database and launch the Joomla.
Create a deploy-mysql.yaml file that contains all of the configurations to deploy the MySQL database.
Create a deploy-joomla.yaml file that contains all of the configurations to deploy the Joomla site.
Finally, we will create kustomization.yaml file that contains the sequence to launch the MySQL and Joomla configuration files. Also, this file will create secrets for us.
Run this file to deploy the MySQL and Joomla site on the EKS cluster.
$ kubectl create -k .
Check if all of the resources get launched.
$ kubectl get all
As we can see in the above picture, all of our resources are launched and all of the pods are up and running.
Access the launched site:
To access the launched site open the EXTERNAL-IP provided by the service/joomla in the browser to view the deployed joomla site.
Do the installation.
And finally, our Joomla Content Management System is successfully launched using the EKS cluster.
The configuration files for this project are available at:
Production ready code to deploy Joomla on AWS-EKS $ aws eks update-kubeconfig --name mycluster $ yum install…
You can follow the same steps to launch either WordPress or Drupal on the AWS-EKS.