Skip to content

Latest commit

 

History

History
134 lines (126 loc) · 5.31 KB

read.md

File metadata and controls

134 lines (126 loc) · 5.31 KB

$$\color{green}{\textbf Project: 🎮 \color{red} \textbf {Super} \ \color{orange} \ \textbf Mario \ \textbf Bros 🍄🐢}$$

$\color{blue} \textbf {Project Workflow}$

Step 1: Launch instance using 2 cpu and 4 GB memory and Connect Ec2 instance

sudo apt update

$\color{red} \textbf {install and start using Docker}$

sudo apt install docker .io
sudo systemctl start docker
sudo usermod -aG docker ubuntu
newgrp docker
docker --version

Screenshot 2024-11-25 152933

$\color{red} \textbf {install and terraform}$

sudo apt-get update && sudo apt-get install -y gnupg software-properties-common

wget -O- https://apt.releases.hashicorp.com/gpg | \
gpg --dearmor | \
sudo tee /usr/share/keyrings/hashicorp-archive-keyring.gpg > /dev/null

gpg --no-default-keyring \
--keyring /usr/share/keyrings/hashicorp-archive-keyring.gpg \
--fingerprint

echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] \
https://apt.releases.hashicorp.com $(lsb_release -cs) main" | \
sudo tee /etc/apt/sources.list.d/hashicorp.list

sudo apt update
sudo apt-get install terraform
terraform --version

Screenshot 2024-11-25 153003

$\color{red} \textbf {install aws cli}$

curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
sudo apt install unzip 
unzip awscliv2.zip
sudo ./aws/install
aws --version

Screenshot 2024-11-25 153035

$\color{red} \textbf {install kubectl}$

Download latest version with this command

curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"

curl is a command-line tool for transferring data from a server. -LO -L: Follow redirects if the URL redirects to another location. -O: Save the file with its original name (in this case, kubectl). https://dl.k8s.io/release/$(...) - The URL specifies where the kubectl binary is hosted. $(...) - This is command substitution in Bash. It executes the command inside the parentheses and substitutes the output. curl -L -s https://dl.k8s.io/release/stable.txt - This inner curl command fetches the latest stable Kubernetes version from the file stable.txt hosted on the Kubernetes server. The -s option makes it silent, so it suppresses unnecessary output. /bin/linux/amd64/kubectl bin: Indicates it's a binary file. linux/amd64: Specifies the platform as Linux and the architecture as AMD64 (common for most modern 64-bit CPUs). kubectl: The Kubernetes command-line tool being downloaded.

Validate the binary

 curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl.sha256"

Validate the kubectl binary against the checksum file

echo "$(cat kubectl.sha256)  kubectl" | sha256sum --check

insatll Kubectl

sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl

If you do not have root access on the target system, you can still install kubectl to the ~/.local/bin directory:

chmod +x kubectl
mkdir -p ~/.local/bin
mv ./kubectl ~/.local/bin/kubectl
kubectl version --client

Screenshot 2024-11-25 153114

$\color{red} \textbf {Iam Role for EC2}$

Create Role Screenshot (564)

$\color{red} \textbf {Attach Iam role to the EC2}$

go to EC2 click on actions → security → modify IAM role option Screenshot (565) Screenshot (566)

$\color{red} \textbf {Create S3 Bucket}$

WhatsApp Image 2024-11-25 at 4 23 20 PM

sudo apt install git -y
git clone https://github.com/aamage20/Super-Mario.git
cd Super-Mario
cd EKS-Terraform
vim backend.tf

Screenshot (567) $\color{blue} \textbf {Create \ Infra:}$

terraform init
terraform plan
terraform apply --auto-approve
aws eks update-kubeconfig --name EKS_CLOUD --region us-west-1 --profile eks

$\color{red} \textbf {Creation of deployment and service for EKS}$

change the directory where deployment and service files are stored use the command →

cd ..

$\color{blue} \textbf {create the deployment}$

kubectl apply -f deployment.yaml

$\color{blue} \textbf {Now create the service}$

kubectl apply -f service.yaml
kubectl get all
kubectl get svc mario-service

copy the load balancer ingress and paste it on browser and your game is running Screenshot 2024-11-25 154054 $\color{green} \textbf {Final Output: Enjoy The Game 🎮}$ Screenshot 2024-11-25 154158 Delete Infra

 terraform destroy -auto-approve