Deploying WordPress in Amazon EKS with RDS in Backend
WordPress is a free and open-source content management system written in PHP and paired with a MySQL or MariaDB database.
Let’s begin with configuring EKS cluster
select the appropriate Cluster Service Role or create a new one
the endpoint should be public so that we can access the site.
Create the cluster and wait till it becomes active. Now we need to add a Node group to this cluster, where the pods will be launched
In the Node IAM role this policy have to be attached ->
AmazonEKSWorkerNodePolicy
AmazonEC2ContainerRegistryReadOnly
AmazonEKS_CNI_Policy
select the instance type as needed
select the minimum and max nodes to be present in case the load keeps varying
wait for the node-group to get ready
now connect to the cluster by ->
aws eks --region <region-code> update-kubeconfig --name <cluster-name>
It is necessary to be using the aws commands with same user that created the cluster.
Let’s create a deployment with the wordpress image ->
kubectl create deployment <name> --image=<image-name>
Let’s scale the deployment to 2 replicas ->
kubectl scale deployment <name> --replicas=<number>
Now we see two pods running
Expose port no. 80 so that client and the database can connect to pod
CREATING THE DATABASE WITH AWS RDS
Let’s use MySQL database
Wait till the database is Available
connect to mysql server and create the database on it
Now open the wordpress webui and enter the details as required, when everything is correct then this page will appear
After successful login this page appears, now we can use WordPress!