This repo is all about Deploying-and-Managing-a-Pac-Man-Game-on-AWS-EKS-using-Terraform.
Lets start the adventure!!
STEP 1 :
1.Deploy the EKS Cluster with Terraform.
2.git clone Github Repo(git clone [email protected]:bikrantsahoo/Deploy-webapp-with-techstack-terraform-aws--eks.git)
3.Change into the eks directory: cd eks
4.ls now & we should see the eks-cluster.tf, main.tf, outputs.tf, terraform.tf, variables.tf, and vpc.tf configuration files.
5.Initialize the working directory: terraform init
6.Validate the configuration: terraform validate
7.Now apply the configuration and deploy the EKS cluster: terraform apply -auto-approve
Note: It can take between 15 and 20 minutes to deploy the eks cluster.
STEP 2 :
Once aws eks cluster is deployed, configure the Kubernetes CLI to use the cluster’s context.
aws eks --region
STEP 3 :
- Complete the Terraform Configuration by change into main directory
- cd ../pac-man/
- Docker Image used for this lab is “docker.io/jessehoch/pacman-nodejs-app:latest”
- terraform init
- terraform validate
- terraform apply -auto-approve
STEP 4 :
- Once deployed, confirm that the web application resources were deployed in the pac-man namespace and are available.
- kubectl -n pac-man get all
- We should see that the mongo and pac-man pods, services, deployments, and replicas are all available and running as expected.
- For the pac-man service, copy the DNS record provided in the EXTERNAL-IP column.
- In a new browser tab or window, paste the external IP address and hit Enter.
- When the Pac-Man web application launches.
- Click to play as instructed, and play the game to confirm that it is working as expected.
STEP 5 :
- Scale the AWS EKS Pac-Man Application.
- Edit the MongoDB deployment configuration file:
- vi modules/mongo/mongo-deployment.tf
- For the replicas spec, update the replicas value to 2. save & exit.
- Edit the Pac-Man deployment configuration file:
- vi modules/pac-man/pac-man-deployment.tf
- For the replicas spec, update the replicas value to 3. save & exit.
- Apply the updates to the configuration : terraform apply
- When prompted, enter yes to confirm.
- Confirm that the resources were updated: kubectl -n pac-man get all
- We should see that the mongo and pac-man pods, deployments, and replicas have all been scaled up to 2 and 3, respectively.
- In the browser, refresh the Pac-Man web application and confirm that it is still working as expected.
STEP 6 :
- Edit the MongoDB and Pac-Man deployment configuration files again, this time changing the replicas back to 1.
- Apply the updates to the configuration : terraform apply
- Confirm that the resources were updated: kubectl -n pac-man get all
- We should see that the mongo and pac-man pods, deployments, and replicas have all been scaled back down to 1 each.
- In the browser, refresh the Pac-Man web application and confirm that it is still working as expected.
STEP 7 :
destory all the above proofs by terraform destroy.
Congrtulation for completing the prject involving aws eks/terraform and deploying this game pacman