TWS Three-Tier-Application Project Guide With Interview Questions

Akshay ShindeAkshay Shinde
8 min read

Application Code:

The Application-Code directory contains the source code for the Three-Tier Web Application. Dive into this directory to explore the frontend and backend implementations.

Jenkins Pipeline Code:

In the Jenkins-Pipeline-Code directory, you'll find Jenkins pipeline scripts. These scripts automate the CI/CD process, ensuring smooth integration and deployment of your application.

Jenkins Server Terraform:

Explore the Jenkins-Server-TF directory to find Terraform scripts for setting up the Jenkins Server on AWS. These scripts simplify the infrastructure provisioning process.

Kubernetes Manifests Files:

The Kubernetes-Manifests-Files directory holds Kubernetes manifests for deploying your application on AWS EKS. Understand and customize these files to suit your project needs.

Project Details:

Tools Explored:

  1. Terraform & AWS CLI for AWS infrastructure

  2. Jenkins, Sonarqube, Terraform, Kubectl, and more for CI/CD setup

  3. Helm, Prometheus, and Grafana for Monitoring

  4. ArgoCD for GitOps practices

High-Level Overview:

  1. IAM User setup & Terraform magic on AWS

  2. Jenkins deployment with AWS integration

  3. EKS Cluster creation & Load Balancer configuration

  4. Private ECR repositories for secure image management

  5. Helm charts for efficient monitoring setup

  6. GitOps with ArgoCD - the cherry on top!

๐Ÿ“ˆ The journey covered everything from setting up tools to deploying a Three-Tier app, ensuring data persistence, and implementing CI/CD pipelines.

Getting Started:

To get started with this project, refer to our comprehensive guide that walks you through IAM user setup, infrastructure provisioning, CI/CD pipeline configuration, EKS cluster creation, and more.

Step 1: IAM Configuration

  • Create a user eks-admin with AdministratorAccess.

  • Generate Security Credentials: Access Key and Secret Access Key.

Step 2: EC2 Setup

  • Launch an Ubuntu instance in your favourite region (eg. region us-west-2).

  • SSH into the instance from your local machine.

Step 3: Install AWS CLI v2

curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
sudo apt install unzip
unzip awscliv2.zip
sudo ./aws/install -i /usr/local/aws-cli -b /usr/local/bin --update
aws configure

Step 4: Install Docker

sudo apt-get update
sudo apt install docker.io
docker ps
sudo chown $USER /var/run/docker.sock

Step 5: Install kubectl

curl -o kubectl https://amazon-eks.s3.us-west-2.amazonaws.com/1.19.6/2021-01-05/bin/linux/amd64/kubectl
chmod +x ./kubectl
sudo mv ./kubectl /usr/local/bin
kubectl version --short --client

Step 6: Install eksctl

curl --silent --location "https://github.com/weaveworks/eksctl/releases/latest/download/eksctl_$(uname -s)_amd64.tar.gz" | tar xz -C /tmp
sudo mv /tmp/eksctl /usr/local/bin
eksctl version

Step 7: Setup EKS Cluster

eksctl create cluster --name three-tier-cluster --region us-west-2 --node-type t2.medium --nodes-min 2 --nodes-max 2
aws eks update-kubeconfig --region us-west-2 --name three-tier-cluster
kubectl get nodes

Step 8: Run Manifests

kubectl create namespace workshop
kubectl apply -f .
kubectl delete -f .

Step 9: Install AWS Load Balancer

curl -O https://raw.githubusercontent.com/kubernetes-sigs/aws-load-balancer-controller/v2.5.4/docs/install/iam_policy.json
aws iam create-policy --policy-name AWSLoadBalancerControllerIAMPolicy --policy-document file://iam_policy.json
eksctl utils associate-iam-oidc-provider --region=us-west-2 --cluster=three-tier-cluster --approve
eksctl create iamserviceaccount --cluster=three-tier-cluster --namespace=kube-system --name=aws-load-balancer-controller --role-name AmazonEKSLoadBalancerControllerRole --attach-policy-arn=arn:aws:iam::626072240565:policy/AWSLoadBalancerControllerIAMPolicy --approve --region=us-west-

Step 10: Deploy AWS Load Balancer Controller

sudo snap install helm --classic
helm repo add eks https://aws.github.io/eks-charts
helm repo update eks
helm install aws-load-balancer-controller eks/aws-load-balancer-controller -n kube-system --set clusterName=my-cluster --set serviceAccount.create=false --set serviceAccount.name=aws-load-balancer-controller
kubectl get deployment -n kube-system aws-load-balancer-controller
kubectl apply -f full_stack_lb.yaml

CPU Usage:

Cleanup

  • To delete the EKS cluster:
eksctl delete cluster --name three-tier-cluster --region us-west-2

Contribution Guidelines

  • Fork the repository and create your feature branch.

  • Deploy the application, adding your creative enhancements.

  • Ensure your code adheres to the project's style and contribution guidelines.

  • Submit a Pull Request with a detailed description of your changes

Interview Question Based on this Project:

  1. Can you explain the purpose of the Three-Tier-Application project?

    Answer: Three-Tier-Application project aims to encourage participants to deploy a Three-Tier Web Application using ReactJS, NodeJS, and MongoDB, with deployment on AWS EKS (Elastic Kubernetes Service). It involves leveraging various DevOps tools like Docker, Jenkins, Terraform, Kubernetes, Helm, and more to automate the CI/CD pipeline and infrastructure provisioning, ensuring smooth integration and deployment processes

  2. What are the key components of the project, and what roles do they play?

    Answer: The key components of the project include:

    1. Application Code: Contains the source code for the Three-Tier Web Application, including frontend (ReactJS) and backend (NodeJS with MongoDB) implementations.

    2. Jenkins Pipeline Code: Scripts to automate the CI/CD process using Jenkins, ensuring smooth integration and deployment.

    3. Jenkins Server Terraform: Terraform scripts for setting up the Jenkins Server on AWS, simplifying infrastructure provisioning.

    4. Kubernetes Manifests Files: Manifests for deploying the application on AWS EKS, facilitating efficient management and scaling of containers.

Each component plays a crucial role in different stages of the project, from application development and testing to deployment and monitoring.

  1. Can you walk me through the high-level overview of the project's journey?

    Answer: The project's journey covers the following key aspects:

    1. Setting up AWS infrastructure using Terraform and AWS CLI, including IAM user setup, EC2 instance launch, and EKS cluster creation.

    2. Deploying Jenkins with AWS integration for CI/CD automation.

    3. Configuring EKS cluster and load balancer for container orchestration and traffic distribution.

    4. Setting up private ECR repositories for secure image management.

    5. Utilizing Helm, Prometheus, and Grafana for monitoring.

    6. Implementing GitOps practices with ArgoCD for efficient continuous delivery.

  2. How is the EKS Cluster created in the project?

    Answer: The EKS Cluster is created using eksctl. Participants can follow the provided command to create a cluster with specified configurations, such as node type, min and max nodes, and region.

  3. What are the steps involved in setting up AWS CLI v2?

    Answer: The steps involved in setting up AWS CLI v2 include downloading the CLI package, installing it on the local machine, and configuring it with Access Key and Secret Access Key.

  4. What is the purpose of Kubernetes Manifests Files?

    Answer: The Kubernetes Manifests Files contain manifests for deploying the application on AWS EKS. These files help in defining the desired state of Kubernetes objects required for the application deployment.

  5. What role does Terraform play in the project?

    Answer: Terraform is used for infrastructure provisioning on AWS. It simplifies the process of setting up the Jenkins Server, EKS Cluster, and other necessary resources by providing scripts in the Jenkins Server Terraform directory.

  6. How does Jenkins contribute to the project?

    Answer: Jenkins contributes to the project by automating the CI/CD process. It ensures smooth integration and deployment of the application through pipeline scripts

  7. Which tools are used in this project, and what is the purpose of those tools?

    1. Terraform: Terraform is employed for infrastructure provisioning on AWS. It helps define, manage, and version control infrastructure in a declarative manner, ensuring consistency and reliability across environments.

    2. AWS CLI (Command Line Interface): The AWS CLI facilitates interaction with AWS services from the command line. It is used for tasks such as user management, resource configuration, and cluster creation on AWS.

    3. Jenkins: Jenkins is utilized for automation of the CI/CD pipeline. It automates building, testing, and deployment processes, integrating with various tools to ensure smooth software delivery.

    4. Kubernetes (EKS): Kubernetes, specifically AWS EKS (Elastic Kubernetes Service), is the container orchestration platform employed for deploying and managing containerized applications. It automates container lifecycle management, scaling, and load balancing.

    5. Docker: Docker is used for containerization of application components. It packages applications and their dependencies into standardized units called containers, enabling consistency in deployment across different environments.

    6. Helm: Helm serves as a package manager for Kubernetes applications. It simplifies the deployment and management of Kubernetes resources through charts, enabling easy distribution and versioning of applications.

    7. Prometheus: Prometheus is employed for monitoring and alerting within the Kubernetes environment. It collects and stores metrics from applications and infrastructure, enabling real-time monitoring and analysis of system performance.

    8. Grafana: Grafana is utilized for visualization and analytics of monitoring data. It provides dashboards and graphs for visualizing metrics collected by Prometheus, aiding in monitoring and troubleshooting.

    9. ArgoCD: ArgoCD implements GitOps practices for continuous delivery on Kubernetes. It synchronizes Kubernetes configurations stored in Git repositories with the desired state, ensuring consistency and reliability in application deployment.

    10. Eksctl: Eksctl is a command-line utility for managing Amazon EKS clusters. It simplifies the creation, scaling, and management of Kubernetes clusters on AWS, reducing the operational overhead of cluster management.

  8. What is the function of load balancer?

Answer:A load balancer is a networking device or service that distributes incoming network traffic across multiple servers or computing resources. Its primary function is to enhance the availability and reliability of applications by evenly distributing the workload among the servers, preventing any single server from becoming overwhelmed with traffic.

The main functions of a load balancer include:

  1. Traffic Distribution: Load balancers evenly distribute incoming traffic across multiple servers or resources, ensuring optimal utilization of resources and preventing any single server from being overloaded.

  2. High Availability: Load balancers improve the availability of applications by automatically routing traffic away from servers that are experiencing issues or downtime. This ensures uninterrupted access to applications for users.

  3. Fault Tolerance: Load balancers can detect server failures or unhealthy instances and automatically reroute traffic to healthy servers, minimizing service disruptions and maintaining application availability.

  4. Scalability: Load balancers facilitate horizontal scaling by allowing new servers or resources to be added to the pool dynamically. This enables applications to handle increased traffic and scale out to meet growing demand.

  5. Health Checks: Load balancers continuously monitor the health and performance of servers by periodically sending health checks or probes. If a server fails a health check, the load balancer stops routing traffic to that server until it becomes healthy again.

2
Subscribe to my newsletter

Read articles from Akshay Shinde directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Akshay Shinde
Akshay Shinde