Deploying WordPress application on Kubernetes with AWS RDS using terraform

Image for post
Image for post

Task Description

I have written Infrastructure as code using Terraform, which automatically deploys the WordPress application. On AWS, I have used RDS service for the relational database for WordPress application. Then I deployed WordPress as a container on top of Minikube, the WordPress application is accessible to the public world.

Kubernetes is a portable, extensible, open-source platform for managing containerized workloads and services, that facilitates both declarative configuration and automation

A Kubernetes cluster is a set of node machines for running containerized applications. If you’re running Kubernetes, you’re running a cluster. At a minimum, a cluster contains a control plane and one or more compute machines, or nodes. The control plane is responsible for maintaining the desired state of the cluster, such as which applications are running and which container images they use. Nodes actually run the applications and workloads.

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.

Minikube is an open-source tool that helps to run Kubernetes on a local computer. Before using minikube we need to start it so here I wrote terraform code to start minikube on my Local Computer.

Let’s start with Project in detail

🔰Problem Description:-

🔷 Write an Infrastructure as code using Terraform, which automatically deploy the WordPress application

🔷 On AWS, use RDS service for the relational database for WordPress application.

🔷 Deploy WordPress as a container either on top of Minikube or EKS or Fargate service on AWS.

🔷 The WordPress application should be accessible from the public world if deployed on AWS or through workstation if deployed on Minikube.

notepad wp.tf

Image for post
Image for post
Image for post
Image for post
Image for post
Image for post
Image for post
Image for post

notepad dbsql.tf

Image for post
Image for post

notepad main.tf

Image for post
Image for post

RDS will be created on top of AWS.

To deploy complete Infrastructure-

In Order to Build the Complete Infrastructure, At first, we have to initialize Terraform -

terraform init

Image for post
Image for post
Image for post
Image for post

We can set-up the Complete Infrastructure in just a single click.

terraform apply — auto-approve

Image for post
Image for post

To check the IP

minikube service list

Image for post
Image for post

To check if the deployment is running fine or not-

kubectl get all

Image for post
Image for post

Using the IP address launch the WordPress Application and enter the details of RDS.

Image for post
Image for post
Image for post
Image for post
Image for post
Image for post

Task has been completed.

Happy learning😊

Written by

Tech enthusiast #Traveller #Explorer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store