EKS Cluster and worker node setup on AWS console

Prerequisites
1. AWS account with Admin privileges.
2. Instances to manage/access EKS cluster using kubectl.
3. AWS CLI to use kubectl utility.

Creation IAM role for EKS cluster(master)

Login to the AWS console, navigate to IAM service(Identity and Access Management). Click on Create Roles → Usecase: EKS cluster (EKS) → Click on Next → Rolename: kbt-eks-cluster-role → Click on Create role.

eks cluster role
Figure 1. kbt-eks-cluster-role

Creation of EKS cluster

Navigate to EKS console , then click on create cluster, follow the below steps to create cluster(master).

STEP 1: Configure cluster

Name                : kbt-mercodesk
Kubernetes version  : 1.27
Cluster service role: select the IAM role that is created on Step-1

STEP 2: Specify Networking

Select the VPC, subnets and the Security group for the cluster.
For the cluster endpoint, select Public & Private(based on the environment).
Click on Next.

STEP 3: Select add-ons

By default, CoreDNS, Kube-proxy and Amazon VPC CNI are enabled.
Click on Next and Create.
eks cluster
Figure 2. kbt_mercodesk

Creation of IAM role for EKS worker nodes

Navigate to IAM console, select use case as EC2. Give the role name as ms_md_worker_node_role and attach the policies mentioned below,

AmazonEC2ContainerRegistryReadOnly policy
Amazon_EKS_CNI policy
WorkerNodePolicy
worker node role
Figure 3. ms_md_worker_node_role

Creation of worker nodes

To add worker node group to this cluster,

  1. Navigate to EKS console , click on the cluster name that is created, then switch to the compute tab and click on Add node group.

  2. Give Name: kbt_worker node and select the IAM role that is created on Step-3. Click Next.

  3. For launch configuration give AMI type as Amazon Linux 2(ALU_x86_64), capacity type as On-demand and select the instance tye as t3.medium.

  4. Under Node group scaling configuration, Select desired , min, max number of nodes required.

  5. Select the subnets in VPC, where the nodes have to run.

worker node group
Figure 4. kbt_workernode

Create an EC2 instance

Create one EC2 instance with t2.small type. This instance will talk to our EKS cluster created to place the pods SSH into this instance using the command,

ssh -i <keypair>@<instance_ip>
  1. Install or update the latest version of the AWS CLI using aws Documentation.

  2. Installing updating kubectl using aws Documentation.

  3. Configure AWS CLI using root/ IAM user Access key and Secret key. (or) If you want to Generating AWS Access Key and Secret Key

  4. Attach IAM role with required policies.