Deployment of Wordpress on Kubernetes and Integrating it with AWS RDS

Deployment of Wordpress on Kubernetes and Integrating it with AWS RDS

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

No alt text provided for this image

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

No alt text provided for this image

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:-

  1. In My case i have used minikube to run Kubernetes locally.


No alt text provided for this image

2. Make sure the minikube is running locally on your VM.


No alt text provided for this image

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.


No alt text provided for this image

4. Similarly, here is the Kubernetes deployment snap code of Kubernetes. Do the changes accordingly.


No alt text provided for this image

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.


No alt text provided for this image

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.


No alt text provided for this image

7. Now download the necessary plugins by running terraform init command.


No alt text provided for this image

8. It is always a good practice to run the plan command so that workflow of the code can be seen.


No alt text provided for this image
No alt text provided for this image
No alt text provided for this image
No alt text provided for this image
No alt text provided for this image
No alt text provided for this image
No alt text provided for this image

9. Now after successful completion of plan, it's time to run terraform apply command so the wordpress could be deployed in minikube cluster.


No alt text provided for this image
No alt text provided for this image

10. So it has been deployed.


No alt text provided for this image

11. You can check the wordpress pods and its replica set has been sucessfully deployed.


No alt text provided for this image

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.


No alt text provided for this image

13. Again download the aws plugins by using the terraform init command.


No alt text provided for this image

14. Run the terraform apply command.


No alt text provided for this image
No alt text provided for this image

15. So AWS RDS has been sucessfully created.


No alt text provided for this image

16. You can check manually by going into the aws account.

No alt text provided for this image
No alt text provided for this image
No alt text provided for this image

17. You can run the minikube service list and obtain the URL of wordpress.

No alt text provided for this image

18. So here the wordpress has been deployed.

No alt text provided for this image

19. Give the necessary details and signup.


No alt text provided for this image

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]

要查看或添加评论,请登录

NIRBHAY MAITRA的更多文章

社区洞察

其他会员也浏览了