Skip to content

explicit-logic/eks-module-11.2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

Module 11 - Kubernetes on AWS - EKS

This repository contains a demo project created as part of my DevOps studies in the TechWorld with Nana – DevOps Bootcamp.

Demo Project: Create EKS cluster with Fargate profile

Technologies used: Kubernetes, AWS EKS, AWS Fargate

Project Description:

  • Create Fargate IAM Role
  • Create Fargate Profile
  • Deploy an example application to EKS cluster using Fargate profile

Prerequisites

  • Complete all steps from the previous demo project to create an EKS cluster: eks-module-11.1
  • Ensure kubectl is configured and connected to the cluster (kubectl cluster-info)

Step 1 — Create Fargate IAM Role

  1. Navigate to IAMRolesCreate role

  2. Select trusted entity type: AWS Service

  3. Select use case: EKS - Fargate pod

    Use case selection

  4. Click Next

  5. Verify the attached permissions policy: AmazonEKSFargatePodExecutionRolePolicy

  6. Click Next

  7. Set role name: eks-fargate-role

  8. Click Create role

Step 2 — Create Fargate Profile

  1. Navigate to Amazon EKSClusterseks-clusterCompute

  2. In the Fargate profiles section, click Add Fargate profile

  3. Configure the profile:

    • Name: dev-profile
    • Pod execution role: eks-fargate-role

    Fargate profile configuration

  4. Click Next

  5. Configure pod selection:

    • Namespace: dev
    • Labels: profile = fargate

    Pod selection configuration

  6. Click Next, then Create

Step 3 — Deploy an Example Application Using Fargate

  1. Create the dev namespace:

    kubectl create ns dev
  2. Deploy the Nginx application (3 replicas with a LoadBalancer service):

    kubectl apply -f nginx.yaml

    How Fargate scaling works: Unlike EC2-based node groups, Fargate does not use a Cluster Autoscaler. Each pod is scheduled on its own dedicated micro-VM, so scaling is driven entirely by the number of pod replicas — Fargate provisions and deprovisions compute automatically.

  3. Watch the 3 pods come up and observe the corresponding Fargate nodes:

    kubectl get pods -n dev -o wide -w
    kubectl get nodes

    Deployment result

  4. Scale the deployment back down to 1 replica and verify:

    kubectl scale deployment nginx -n dev --replicas=1
    kubectl get pods -n dev -o wide
    kubectl get nodes

    Scale-down result

Step 4 — Clean Up

Delete all resources in the following order to avoid dependency errors:

  1. Delete the Fargate profile and Node Group from the EKS cluster Compute tab

    Delete node group

  2. Delete the EKS cluster

    Delete cluster

  3. Delete IAM roles (eks-fargate-role and any cluster roles created earlier)

    Delete roles

  4. Delete the CloudFormation stack used for the VPC/networking

    Delete CloudFormation stack

About

Create EKS cluster with Fargate profile

Topics

Resources

Stars

Watchers

Forks

Contributors