DEPLOYING WORDPRESS USIND AWS RDS AND KUBERNATES
Aditya Gupta
Cloud & DevOps Expert | RedHat & AWS Certified | 2+ Yrs Exp | I help Companies Achieve Scalability & Efficiency with Advanced Cloud Solution
Hey guys hope you all are doing good today article gonna be super fun and you can use it for your use as the heading suggests today we are going to deploy WordPress website on Kubernetes and a database will be AWS RDS sounds interesting right ??
Let's start with the process of deployment here I am assuming you have set k8s in your system I am using Kubernetes on minikube you can use aws eks also as discussed in the previous article if not seen click here.
First, let's start with deploying WordPress on Kubernetes using terraform here I am using a minikube cluster.
Step1 start minikube cluster
After this is done I have written terraform code fr running local cmnd in our prompt using null resource u can grab code from git hub repo that I attach in the last fetch code from that and move in the directory and after this first cmnd, u have to run terraform init(to install all the required resource) after this you have to run terraform plan to see what's going to deploy and at last terraform apply which will deploy all the things.
Once this is done two more commands we have to run one to get minkube IP(to get minkube IP) and kubectl get svc to get ports where our service is deployed.
Once you get this just go the IP and u see the below type of screen
Once complete till here its time to set a database because we need database name, username, password, and host etc.
Let's start process os setting rds in aws here I have used terraform for deploying rds terraform code I will be putting in my GitHub repo that you can find at the end of the article. Clone the git repo and open the folder and go to cmnd prompt run all three cmnd we discuss above while setting WordPress on Kubernetes.
This gonna be taking time for deploying rds on aws in terraform code one thing you have to remember this line which I highlighted in below pic
They contain DB username, name, port, and password so set accordingly. Once deployment is done go to aws console.
In the above image you can see info creating means it is creating once it is done you can see the domain name in the endpoint that is what your host.
Once this is created now we create one ec2 instance from which we can see database and table in DB.
Please see the above image carefully in that I have used some command of MySQL to connect remotely from instance.
Once you create databases inside DB then move to WordPress site and fill the required information.
Once all this is done we all are ready to go
Here above you can see our site is deployed successfully.
now if you want to destroy use terraform destroy
Here we come to the end of the article I hope you like the article thanks for reading till here. Below I am attaching Git repo all terraform code will be inside the repo.