Set up your EKS cluster like a Game๐ŸŽ†๐ŸŽฎ

Set up your EKS cluster like a Game๐ŸŽ†๐ŸŽฎ

ยท

4 min read

Elastic Kubernetes Service (EKS) is the Kubernetes service managed by AWS. It is a managed service that helps simplify the deployment, management, and scaling of the Kubernetes cluster on the AWS cloud platform. It provides seamless integration with various AWS services like CloudWatch, VPC, and IAM, making it easier to utilize AWS resources which helps to improve performance, security, and scaling. This service follows the AWS pricing model where users only need to pay for the used resources required to manage the EKS cluster which helps to optimize pricing.

๐Ÿ“š Follow these steps to set up the EKS cluster:

  • Configure the EC2 instance which is going to be an entry point of our EKS cluster, you can use t2.micro(free tier) for that.

    • Connect your instance using SSH to give commands and interact from your terminal.

    • Do the pre-requisites with the newly launched instance sudo apt update

๐Ÿ“ฒ Install AWS CLI:

curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"

sudo apt install unzip

unzip awscliv2.zip

sudo ./aws/install -i /usr/local/aws-cli -b /usr/local/bin --update
  • This command basically installs the aws cli which command line tool to interact with AWS.

You can confirm your installation with:

aws --version

๐Ÿ‘จโ€๐Ÿ’ป Configure IAM User:

  • Configure your IAM user which will give you the access keys to connect with your AWS securely through the terminal and ensure that to have required specific permissions to create and use AWS resources and services.

  • Navigate to the IAM settings and click on Create User.

  • Give a suitable username to the IAM group.

    No need to check the box to provide access to the management console. and click on the next.

    Set permissions as per the requirements to do so select Attach policies directly. In this example, I'm giving admin access.

  • Now your user is created "eks-admin".

  • Go to the security credentials and click on create credentials.

  • Click on the Create Access key.

  • Then you will see this interface which will give several types of options to create an access key.

    • Select the Command Line Interface(CLI) option.

    • Then check the box of confirmation and click next.

    • On the next page, you can see the generated access keys.

      • Now configure your ec2 instance with the IAM user you have created to give all required permissions to create an EKS cluster.

      • Go to the terminal and type the command aws configure

      • Then the terminal will ask you for credentials and region, and put in the generated credentials and region.

          aws configure
        

๐ŸŽก Now we are going to set up Kubernetes tools.

๐Ÿ“œ Install Kubectl:

curl -o kubectl https://amazon-eks.s3.us-west-2.amazonaws.com/1.19.6/2021-01-05/bin/linux/amd64/kubectl

chmod +x ./kubectl

sudo mv ./kubectl /usr/local/bin

kubectl version --short --client

Confirm your installation kubectl version --short --client with this command, you will get the output.

๐Ÿ“Ÿ Install eksctl :

curl --silent --location "https://github.com/weaveworks/eksctl/releases/latest/download/eksctl_$(uname -s)_amd64.tar.gz" | tar xz -C /tmp

sudo mv /tmp/eksctl /usr/local/bin

eksctl version
  • Confirm your installation eksctl version with this command, you will get the output: 0.165.0

  • Now to create your cluster with this command:

      eksctl create cluster --name 2-tier-app-cluster --region ap-south-1 --node-type t2.micro --nodes-min 2 --nodes-max 4
    

  • It will take 15-20 minutes to create the cluster.

After successfully creating the cluster see the running nodes.

kubectl get nodes
  • You will see your EKS cluster is active.

  • You will see this output where you can see the running nodes.

๐Ÿ’ฃDestroying cluster:

  • It's easy to destroy clusters through the terminal if you are trying to destroy it from the console it's a bit difficult.

  • Because the EKS cluster uses AWS's LoadBalancer service in the background

  • So in case you terminated your entry point instance you will need to manually delete the load balancer service.

  • So always use the command to destroy the cluster.

  • A command for destroying cluster

      eksctl delete cluster --name 2-tier-app-cluster
    

    Replace the cluster name with your cluster name.

    \...................................................................................................................................................

    The above information is up to my understanding. Suggestions are always welcome. Thanks for reading this article.๐Ÿ˜Š

    #aws #cloudcomputing #docker #Devops #TrainWithShubham #90daysofdevopsc #happylearning

    Follow for many such contents:

    LinkedIn: linkedin.com/in/dushyant-kumar-dk

    Blog: dushyantkumark.hashnode.dev

    Github: https://github.com/dushyantkumark/two-tier-flask-app/tree/main

ย