How To Set Up Kubernetes in AWS Using EKS

Create the EKS cluster using the console / CLI

Then in the cloud shell run the following

aws eks update-kubeconfig --name {cluster_name} --region {aws_region}

Then create a Launch Template

After that, create an IAM role and security group for nodegroup

During the creation process, don’t choose any AMI, use instance type t3.medium ( or larger ) and use the Security group previously created.

After that, add the IAM role to the aws-auth config map. Commands are given below

curl -o aws-auth-cm.yaml

Then edit the file and replace the rolearn with the IAM role arn

apiVersion: v1
kind: ConfigMap
  name: aws-auth
  namespace: kube-system
  mapRoles: |
    - rolearn: <ARN of instance role (not instance profile)>
      username: system:node:{{EC2PrivateDNSName}}
        - system:bootstrappers
        - system:nodes

After that, run this command to apply.

kubectl apply -f aws-auth-cm.yaml

Then create nodegroup using the Launch Template.

If that is successful then you will see nodes running inside the EKS cluster.

Now you can deploy apps to the EKS via kubectl

Leave a Comment

Your email address will not be published. Required fields are marked *