Game-2048 On AWS EKS | EKS Install and app deploy with Ingress

In this project , we are deploying a web application called Game-2048 on AWS with Ingress On Elastic Kubernetes Service (EKS) & the Installation of the EKS using the eksctl .

Pre-requisites -

Installation of AWS CLI Installation of Kubectl Installation of eksctl AWS Account

eksctl

is a command-line utility for working with Amazon EKS (Elastic Kubernetes Service). It simplifies the process of creating, managing, and operating Kubernetes clusters on AWS. eksctl is an official CLI tool provided by AWS for interacting with EKS.

Create a user and set Access & Secrete Access key

aws configure command for connecting the aws cli using the Access & Secrete Access key

aws configure

Step 1 : Creating the Cluster & Node Group using the eksctl

aws eks update-kubeconfig --region us-east-2 --name myEKS_Cluster

This command is used to update the kubeconfig file for your Amazon EKS (Elastic Kubernetes Service) cluster. The kubeconfig file is a configuration file used by kubectl, the Kubernetes command-line tool, to connect to and interact with a Kubernetes cluster.

eksctl  create cluster --name (name)  --region (region name)

This command for the creating the cluster & node group on the EKS

cluster created

Node created

Amazon ECS (Elastic Container Service) is a container management service provided by Amazon Web Services (AWS). AWS Fargate is a technology integrated with ECS that allows you to run containers without managing the underlying infrastructure. Fargate removes the need for you to interact with or think about the instances that your containers run on.

Step 2 : Create Fargate profile -

eksctl create fargateprofile
--cluster my-cluster
--region us-east-2
--name alb-sample-app
--namespace game-2048

Deploy the deployment, service and Ingress

Step 3 : Deploy the deployment, service and Ingress

kubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/aws-load-balancer-controller/v2.5.4/docs/examples/2048/2048_full.yaml

This command is a convenient way to deploy a complete application stack, including the necessary Kubernetes resources for deployment, service, and ingress, along with the AWS Load Balancer Controller configuration.

Pods are now running state

Check if there is an IAM OIDC provider configured already

eksctl utils associate-iam-oidc-provider --cluster (cluster_name) --approve

In AWS, you can configure an IAM OIDC (OpenID Connect) provider to establish a trust relationship between your OIDC-compatible identity provider (IdP) and AWS. To check if an IAM OIDC provider is configured, you can use the AWS CLI.

Step 4 : How to setup alb add on (Application Load Balancer)

The AWS ALB (Application Load Balancer) Controller is an add-on that makes it easier to set up and manage ingress for applications running on Kubernetes. The ALB Controller configures AWS resources like ALBs and target groups to route traffic to your applications. This simplifies the process of exposing your services to the internet or other parts of your infrastructure.

Download IAM policy

curl -O https://raw.githubusercontent.com/kubernetes-sigs/aws-load-balancer-controller/v2.5.4/docs/install/iam_policy.json

Create IAM Policy

aws iam create-policy \
    --policy-name AWSLoadBalancerControllerIAMPolicy \
    --policy-document file://iam_policy.json

Create IAM Role

eksctl create iamserviceaccount \
  --cluster=my-cluster \
  --namespace=kube-system \
  --name=aws-load-balancer-controller \
  --role-name AmazonEKSLoadBalancerControllerRole \
  --attach-policy-arn=arn:aws:iam::<your-aws-account-id>:policy/AWSLoadBalancerControllerIAMPolicy \
  --approve

Deploy ALB controller

Add helm repo

sudo snap install helm --classic
helm repo add eks https://aws.github.io/eks-charts

Update the repo

helm repo update eks

Install

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 \
  --set region=<region> \
  --set vpcId=<your-vpc-id>

Verify that the deployments are running.

kubectl get deployment -n kube-system aws-load-balancer-controller

kubectl get pods -n kube-system

Copy thr DNS name which is mension in the loadbalancers section & also mension in thr above image

Output- Game 2048

Last updated