Deploying WordPress on MiniKube and AWS RDS with Terraform
In this blog we are gonna to discuss how to launch WordPress application in Minikube & RDS on AWS using Terraform.
What is WordPress?
WordPress is a free and open-source content management system (CMS) written in PHP and paired with a MySQL or MariaDB database. it is web publishing software you can use to create a beautiful website or blog.
What is AWS RDS ?
Amazon Relational Database Service (Amazon RDS) makes it easy to set up, operate, and scale a relational database in the cloud. It provides cost-efficient and resizable capacity while automating time-consuming administration tasks such as hardware provisioning, database setup, patching and backups. It frees you to focus on your applications so you can give them the fast performance, high availability, security and compatibility they need.
AWS RDS provides multiple Database Engine like -
- Amazon Aurora
- PostgreSQL
- MySQL
- MariaDB
- Oracle
- Microsoft SQL Server
What is Minikube ?
Minikube is a tool that lets you run Kubernetes locally. Minikube runs a single-node Kubernetes cluster on your personal computer (including Windows, macOS and Linux PCs) so that you can try out Kubernetes, or for daily development work.
Task 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 the 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.
Prerequisite For the task:-
- Minikube Cluster configure in your VM.
- AWS IAM user credential or AWS profile
- Kubectl command configure properly in your system
Let’s Start Doing our task:-
Write an Infrastructure as code using terraform, which automatically deploy the WordPress application
Here I will launch my WordPress Application in Minikube , Let’s write terraform code for launching WordPress
This will launch the WordPress Application in Minikube , but we know by default nature of Kubernetes , they launch the pod in private world , if we want to access this pod from the public world than we have to expose it, Now we will write the code for exposing our WordPress pod to public world
This will expose our WordPress pod to public world , Let’s run both code and see what will happen
Before run this code Let’s check any pod is running or not in our Minikube cluster , Let’s start our Minikube cluster
For starting Minikube cluster we use “minikube start” command
To check pod we use “Kubectl get pods” commands
Let’s run our code
First of all we have to run “terraform init” command this will download plugins for Kubernetes provider
now we will run command “terraform apply -auto-approve”
Let’s check using “kubectl” command , pod is created or not
They launch the pod and also expose it , Let’s confirm from the browser that our application is accessing from public world or not
write the IP of your minikube and port no on your browser to connect
http://minikube_ip:port_number
Now move to another step
On AWS, use RDS service for the relational database for WordPress application.
Let’s write the terraform code to launch RDS(Relational Database Service) on AWS.
Here we need AWS IAM user or we can create a AWS profile using IAM user , for creating AWS profile we use “aws configure — profile <profile_name>”
Let’s write the code for launching the database
Same thing we have to do here first run “terraform init” command then after run the “terraform apply ”
You can check from AWS Management Console
Now Let’s connect our WordPress Application with Databse
same thing we have to do
write the IP of your minikube and port no on your browser to connect
http://minikube_ip:port_number
Here we have to provide our databse detail then submit
Let’s login and create a blog on it
Thanks for reading….