DEPLOYING WORDPRESS  APPLICATION ON KUBERNETES AND SETTING MYSQL DATABASES ON AWS RDS USING TERRAFORM

DEPLOYING WORDPRESS APPLICATION ON KUBERNETES AND SETTING MYSQL DATABASES ON AWS RDS USING TERRAFORM

HI! There this is the last task in cloud training by vimal daga sir , In this task we learn how we can set up a wordpress deployment using infrastructure as a service along with databse mysql database using aws rds in terraform . Some information regarding aws -->

  • AWS RDS: Amazon Relational Database Service (Amazon RDS) is a web service that makes it easier to set up, operate, and scale a relational database in the AWS Cloud. It provides cost-efficient, resizable capacity for an industry-standard relational database and manages common database administration tasks.
  • KUBERNETES : Kubernetes is a portable, extensible, open-source platform for managing containerized workloads and services, that facilitates both declarative configuration and automation. It has a large, rapidly growing ecosystem. Kubernetes services, support, and tools are widely available.
  • MYSQL DATABASES: MySQL Database Service is a fully managed database service that enables organizations to deploy cloud-native applications using the world's most popular open source database. It is 100% developed, managed and supported by the MySQL Team.

WHAT TO DO IN THE TASK:

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.

So Let`s begin

  • Creating A cluster in the kubernetes and running it:
minikube start --vm-driver virtualbox
minikube start
  • CONFIGURING AND GIVING THE DETAILS :

HERE I AM USING VIRTUAL STUDIO CODE AND I INSTALLED HASHICORP TERRAFORM EXTENTION .

Step 1:) Configuring the terraform by providing the aws profile and providing the virtual box name "minikube" .

No alt text provided for this image

Step 2:) Now we have to create a instance but before this we have to create a security group for that.

No alt text provided for this image

Step 3:) Now we will create a rds instance: I am using MySQL(5.7.30) as database engine,you can select any other as well but you have to be carefull with the accessible nature of wordpress . Here for security we can add some variables in the var.tf file and than we add module tag and we can use source and give the path for the var.tf file and hence we can create security but this is not essential and required for personal working.

No alt text provided for this image

Step 4:) Now we will deploy the wordpress in the container inside the kubernetes cluster , in this we will provide some tags for our instance which will check whether our desired number of containers are working or not.

No alt text provided for this image

LASTLY we have to export/public the port of the working container to some port no so that we can access our port from the outside world.

No alt text provided for this image

Now for running the code we use the commands terraform ini for downloading necessary modules and terraform apply we can also use terraform apply -auto-approve

Now for getting the ip use kubectl all all and your ip will be shown in the nodeport when you run this command.

Now You are all set and you will configure wordpress and work on the wordpress on kubernetes with the database on rds aws.

To view or add a comment, sign in

More articles by Sarthak Mutreja

Insights from the community

Others also viewed

Explore topics