Skip to content

Latest commit

 

History

History
146 lines (110 loc) · 6.19 KB

File metadata and controls

146 lines (110 loc) · 6.19 KB

eks-game2048-project

Deploy Game2048 application in AWS EKS

  1. eksctl create cluster --name game-2048 --region ap-south-1 --fargate

Pasted Graphic

Pasted Graphic 13

Networking of VPC

Pasted Graphic 18

  1. eksctl create fargateprofile --cluster game-2048 --region ap-south-1 --name game2046-fargateprofile --namespace game-2048

Pasted Graphic 1

  1. kubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/aws-load-balancer-controller/v2.8.0/docs/examples/2048/2048_full.yaml
namespace/game-2048 created
deployment.apps/deployment-2048 created
service/service-2048 created
ingress.networking.k8s.io/ingress-2048 created
  1. kubectl get po -n game-2048
NAME                              READY   STATUS    RESTARTS   AGE
deployment-2048-bdbddc878-hj5bc   1/1     Running   0          105s
deployment-2048-bdbddc878-jvjwl   1/1     Running   0          105s
deployment-2048-bdbddc878-nl7lr   1/1     Running   0          105s
deployment-2048-bdbddc878-vrq58   1/1     Running   0          105s
deployment-2048-bdbddc878-x6kkw   1/1     Running   0          105s
  1. curl -O https://raw.githubusercontent.com/kubernetes-sigs/aws-load-balancer-controller/v2.12.0/docs/install/iam_policy.json
% Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  8912  100  8912    0     0   515k      0 --:--:-- --:--:-- --:--:--  543k
  1. aws iam create-policy --policy-name AWSLoadBalancerControllerIAMPolicyForGame2048 --policy-document file://iam_policy.json
{
    "Policy": {
        "PolicyName": "AWSLoadBalancerControllerIAMPolicyForGame2048",
        "PolicyId": "ANPAZNKPEIHBJUHxxxxxx",
        "Arn": "arn:aws:iam::xxxxxxxxxxxx:policy/AWSLoadBalancerControllerIAMPolicyForGame2048",
        "Path": "/",
        "DefaultVersionId": "v1",
        "AttachmentCount": 0,
        "PermissionsBoundaryUsageCount": 0,
        "IsAttachable": true,
        "CreateDate": "2025-05-01T07:05:39+00:00",
        "UpdateDate": "2025-05-01T07:05:39+00:00"
    }
}

oidc_id=$(aws eks describe-cluster --name game-2048 --query "cluster.identity.oidc.issuer" --output text | cut -d '/' -f 5)

aws iam list-open-id-connect-providers | grep $oidc_id | cut -d "/" -f4

eksctl utils associate-iam-oidc-provider --cluster game-2048 --approve

2025-05-01 07:10:15 [ℹ]  will create IAM Open ID Connect provider for cluster "game-2048" in "ap-south-1"
2025-05-01 07:10:16 [✔]  created IAM Open ID Connect provider for cluster "game-2048" in "ap-south-1"
  1. eksctl create iamserviceaccount --cluster=game-2048 --namespace=kube-system --name=aws-load-balancer-controller-for-game2048 --attach-policy-arn=arn:aws:iam::xxxxxxxxxxxx:policy/AWSLoadBalancerControllerIAMPolicyForGame2048 --override-existing-serviceaccounts --region ap-south-1 --approve
2025-05-01 07:14:59 [ℹ]  1 iamserviceaccount (kube-system/aws-load-balancer-controller-for-game2048) was included (based on the include/exclude rules)
2025-05-01 07:14:59 [!]  metadata of serviceaccounts that exist in Kubernetes will be updated, as --override-existing-serviceaccounts was set
2025-05-01 07:14:59 [ℹ]  1 task: { 
    2 sequential sub-tasks: { 
        create IAM role for serviceaccount "kube-system/aws-load-balancer-controller-for-game2048",
        create serviceaccount "kube-system/aws-load-balancer-controller-for-game2048",
    } }2025-05-01 07:14:59 [ℹ]  building iamserviceaccount stack "eksctl-game-2048-addon-iamserviceaccount-kube-system-aws-load-balancer-controller-for-game2048"
2025-05-01 07:14:59 [ℹ]  deploying stack "eksctl-game-2048-addon-iamserviceaccount-kube-system-aws-load-balancer-controller-for-game2048"
2025-05-01 07:14:59 [ℹ]  waiting for CloudFormation stack "eksctl-game-2048-addon-iamserviceaccount-kube-system-aws-load-balancer-controller-for-game2048"
2025-05-01 07:15:29 [ℹ]  waiting for CloudFormation stack "eksctl-game-2048-addon-iamserviceaccount-kube-system-aws-load-balancer-controller-for-game2048"
2025-05-01 07:15:30 [ℹ]  created serviceaccount "kube-system/aws-load-balancer-controller-for-game2048"
  1. helm repo add eks https://aws.github.io/eks-charts
"eks" already exists with the same configuration, skipping
  1. helm repo update eks
Hang tight while we grab the latest from your chart repositories...
...Successfully got an update from the "eks" chart repository
Update Complete. ⎈Happy Helming!⎈
  1. helm install aws-load-balancer-controller eks/aws-load-balancer-controller -n kube-system --set clusterName=game-2048 --set serviceAccount.create=false --set serviceAccount.name=aws-load-balancer-controller-for-game2048 --set region=ap-south-1 --set vpcId=vpc-0ec00a061e60xxxxx
NAME: aws-load-balancer-controller
LAST DEPLOYED: Thu May  1 07:19:21 2025
NAMESPACE: kube-system
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
AWS Load Balancer controller installed!
  1. kubectl get po -n kube-system
NAME                                           READY   STATUS    RESTARTS   AGE
aws-load-balancer-controller-5c875989b-4vg4q   1/1     Running   0          51s
aws-load-balancer-controller-5c875989b-cqs86   1/1     Running   0          51s
.
.
  1. kubectl get ingress -n game-2048
NAME           CLASS   HOSTS   ADDRESS                                                                    PORTS   AGE
ingress-2048   alb     *       k8s-game2048-ingress2-170f34f9e5-181944xxxx.ap-south-1.elb.amazonaws.com   80      22m

How traffic flows from ALB to Pods

Pasted Graphic 15

Hit the DNS of ALB to access the application deployed in pods.

Pasted Graphic 16

Play the game (Game-2048)

Pasted Graphic 17