Deploying App through AWS EKS by using ingress and fargate

 1.Create cluster

Command-  eksctl create cluster --name demo-cluster --region us-east-1 --fargate (15 to 20 min)

2. Once cluster is ready check if it is visible in EKS





3. aws eks update-kubeconfig --name demo-cluster --region us-east-1

output- Added new context arn:aws:eks:us-east-1:533267033126:cluster/demo-cluster to C:\Users\Raghvendra Singh\.kube\config

4. creating fargate profile

Command (linux)- eksctl create fargateprofile \

         --cluster demo-cluster \

         --region us-east-1 \

         --name alb-sample-app \

         --namespace game-2048

windows- eksctl create fargateprofile --cluster demo-cluster --region us-east-1 --name alb-sample-app --namespace game-2048

5. Application deployment-

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

6. After deploying this app, run few commands to check status

- kubectl get pods -n game-2048

- kubectl get pods -n game-2048 -w

- kubectl get svc -n game-2048

7. configure-oidc-controller then alb-controller

 eksctl utils associate-iam-oidc-provider --cluster $cluster_name --approve

before creating alb-controller , we need to create IAM policy and Role with below command.

Download IAM policy- curl -O https://raw.githubusercontent.com/kubernetes-sigs/aws-load-balancer-controller/v2.11.0/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=<your-cluster-name> \

  --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:

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=<your-cluster-name> \

  --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

checking cluster details- aws eks describe-cluster --name demo-cluster --region us-east-1

kubectl get ingress -n game-2048

Access through public url which will get from below command-

kubectl get ingress -n game-2048


Comments

Popular posts from this blog

Core 5 Security Epics in AWS Cloud

Why do you need to monitor your network?