AWS EKS Architecture of WordPress and MySQL With EFS as Persistent Storage

What Is AWS EKS ??

Amazon Elastic Kubernetes Service (Amazon EKS) is a fully managed Kubernetes service.EKS is deeply integrated with services such as Amazon CloudWatch, Auto Scaling Groups, AWS Identity and Access Management (IAM), and Amazon Virtual Private Cloud (VPC), providing you with a seamless experience to monitor, scale, and load-balance Our applications.

First We Require AWS CLI and eksctl i.e. a cli service Only for AWS EKS.

AWS CLI Link & ekctl Link ( Make Sure to Set Env. Path for eksctl )

Lets Login to Our AWS Account using AWS CLI and The Same Will be Used For eksctl Command Aswell

USE “ aws configure ” to log in

Now let’s Create a Cluster, We’ll use YAML file for This

This Cluster consists of 2 NodeGroup. First NodeGrp Has 2 t2.micro type Node and 1 Nodegrp has 1 t2.small type Instance. And also Included Nodegrp for Spot instances which is Optional. You Can Customize Accordingly.

Note: In publicKeyName : Make sure You already Have that Key in Your EC2 Key Pairs.

This process will take around 15–20 minutes to complete. When Completed Several EC2 Instances will be created then we have to SSH To this Instances using the Public IP and SSH key we Provided and Install amazon-efs-utils to Every Instance.

USE “yum install amazon-efs-utils” to Install

Now as We have to update the Config file of kubectl to use the Nodes Created by AWS EKS. For that, we will use AWS CLI.

USE “aws eks update-kubeconfig — name projectCluster”

Let’s Create The WordPress & MySQL Architecture With EFS as Persistent Storage.

Creating EFS :

Now Goto WEBUI of AWS and Create EFS Storage in Your Region With All Default Selection. After it is Created Note down the File System ID and DNS name.

Now For Provisioning EFS Storage as PVC, we have to create a 3 YAML file as Follows. Note: All YAML files are Available at my GitHub Repo. Here


2. Create RBAC (Role-Based Access Control)

3. Create Storage AS PVC

These 3 YAML File will Create EFS as PVC

Now We’ll Create 2 more Deployment of WordPress and MySQL with YAML files

  1. WordPress Deployment

Here We had Created Service For WordPress But In Case of MySQL will Not Create it as we don’t want outside people to connect to the database.

2. MySQL Deployment

Now All Files Are Successfully Created, Now Let Run them In Order Using a Kustomization YAML File Where We will also Create a Secret for OUR MySQL Password.

Now Place all your 6 YAML files in One Directory And Run the RUN These Files Using Kustomization

USE “ kubectl create -k . ”

This Will First Create a Secret and Then Proceed with EFS Provisioning till MYSQL deployment.

Finally, Our WordPress is up and running!! 🤩

Open it Using the Public IP of EC2-Instance!

Thanks for reading!

For YAML file Visit My GITHUB: HERE

If you have any suggestions or doubt feel free to contact or comment below.

Tech. Explorer