Deployment of Wordpress on Kubernetes and Integrating it with AWS RDS
NIRBHAY MAITRA
Full-stack Developer at Mobius by Gaian with expertise in React.js, Node.js and MongoDB
Hey Connections,
So this is my article regarding the task which has been given to us in Multi-Hybrid Cloud Computing by Mr. Vimal Daga Sir!
A brief overview of the task is:-
1. Write an Infrastructure as code using terraform, which automatically deploy the Wordpress application
2. On AWS, use RDS service for the relational database for Wordpress application.
3. Deploy the Wordpress as a container either on top of Minikube or EKS or Fargate service on AWS
4. The Wordpress application should be accessible from the public world if deployed on AWS or through workstation if deployed on Minikube.
TERRAFORM
Terraform is a tool for building, changing, and versioning infrastructure safely and efficiently. Terraform can manage existing and popular service providers as well as custom in-house solutions. Configuration files describe to Terraform the components needed to run a single application or your entire datacenter.
MINIKUBE
Minikube is a tool that makes it easy to run Kubernetes locally. Minikube runs a single-node Kubernetes cluster inside a Virtual Machine (VM) on your laptop for users looking to try out Kubernetes or develop with it day-to-day.
So let us start with our Task:-
- In My case i have used minikube to run Kubernetes locally.
2. Make sure the minikube is running locally on your VM.
3. Here is the Kubernetes provider snap code. You can find it on official site of terraform. Copy-paste on your IDE and do necessary changes.
4. Similarly, here is the Kubernetes deployment snap code of Kubernetes. Do the changes accordingly.
5 . Here i will deploy Wordpress on minikube. So I have changed the variable names accordingly. A ReplicaSet's purpose is to maintain a stable set of replica Pods running at any given time. As such, it is often used to guarantee the availability of a specified number of identical Pods. Labels selector are core grouping primitive in Kubernetes. They are used by the users to select a set of objects. Kubernetes API currently supports two type of selectors ? Equality-based selectors. Set-based selectors.
6. Load balancing is the process of efficiently distributing network traffic among multiple backend services, and is a critical strategy for maximizing scalability and availability. In Kubernetes, there are a variety of choices for load balancing external traffic to pods, each with different tradeoffs. So here in this snap of code i created a load balancer.
7. Now download the necessary plugins by running terraform init command.
8. It is always a good practice to run the plan command so that workflow of the code can be seen.
9. Now after successful completion of plan, it's time to run terraform apply command so the wordpress could be deployed in minikube cluster.
10. So it has been deployed.
11. You can check the wordpress pods and its replica set has been sucessfully deployed.
12. Now we will create aws RDS by the following snap of code. You could also take the help from offcial website of terraform hashicorp on deploying db instance.
13. Again download the aws plugins by using the terraform init command.
14. Run the terraform apply command.
15. So AWS RDS has been sucessfully created.
16. You can check manually by going into the aws account.
17. You can run the minikube service list and obtain the URL of wordpress.
18. So here the wordpress has been deployed.
19. Give the necessary details and signup.
20. So the wordpress has been successfully deployed and opened for you.
This marks the completion of task 6. If you have any questions regarding the task, feel free to contact me on my gmail id which is [email protected]