Deploy the Wordpress application on Kubernetes and AWS using terraform

AWS RDS:

Project Outline:

Steps:

provider "kubernetes" {
config_context_cluster = "minikube"}
resource "kubernetes_deployment" "wordpress" {
metadata {
name = "wordpress"}
//creating the deployment of cluster with 2 replicasspec {
replicas = 2

selector {
match_labels = {
env = "dev"
region = "IN"
App = "wordpress"
}

}

template {
metadata {
labels = {
env = "dev"
region = "IN"
App = "wordpress"
}
}
//Exposing the cluster on the port 80spec {
container {
image = "wordpress:4.8-apache"
name = "wordpressdb"
}
}
}
}

port {
node_port = 32123
port = 80
target_port = 80
}

type = "NodePort"
}
}
terraform init 
terraform plan
terraform apply --auto-approve
kubectl get pods
provider "aws" {
region = "ap-south-1"
}
resource "aws_db_instance" "My_db" {

engine = "mysql"
engine_version = "5.7.30"
instance_class = "db.t2.micro"
allocated_storage = 10
name = "mydb"
username = "wordpress_user"
password = "rootroot"
port = "3306"
publicly_accessible = true
iam_database_authentication_enabled = true
vpc_security_group_ids = ["sg-041bf4230a162e7d0"]
tags = {
Name = "mysql"
}}
minikube ip

--

--

MLOps| Hybrid Cloud | DevOps | Hadoop | Kubernets | Data Science| AWS | GCP |

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
Sriramadasu Prasanth Kumar

MLOps| Hybrid Cloud | DevOps | Hadoop | Kubernets | Data Science| AWS | GCP |