How to setup Amazon EKS Cluster

Step by step Amazon EKS Cluster setup

Intro

Amazon Elastic Kubernetes Service (EKS) is a managed Kubernetes service that makes it easy for you to run Kubernetes on AWS without needing to install, operate, and maintain your own Kubernetes control plane. Click for more details.

Requirements

In order to setup new Amazon EKS, we need an AWS account with root privileges. For the k8s interaction, we also need a client machine. I'll use MacOS for this article.

VPC Setup

This is the first and most important step for our cluster setup. When I try to create VPC myself, I have encountered many errors. First of all, you need to decide on your cluster subnets. We have 3 choices. Public/Public&Private/Private. Detailed architecture explained here.

I choose Public & Private one. In this architecture, our control plane accessible from the public internet, and our workers run in a private network.

AWS-EKS!

To create VPC with cloudformation;

  1. Open the AWS CloudFormation console at https://console.aws.amazon.com/cloudformation.

  2. From the navigation bar, select a Region that supports Amazon EKS.

  3. Choose Create stack, With new resources (standard).

  4. For Choose a template, select Specify an Amazon S3 template URL.

  5. Paste the URL that corresponds to the Region that your cluster is in into the text area and choose Next:

https://amazon-eks.s3.us-west-2.amazonaws.com/cloudformation/2020-08-12/amazon-eks-vpc-private-subnets.yaml

AWS-VPC!

EKS Setup

Now we can continue with the installation. Select EKS from service list. Give a name to your cluster. Select K8s version and Service Role and than press next.

AWS-EKS-INIT!

Select previously created VPC, Subnet and Security group from the current screen. Don't forget to select Public & Private from the Cluster endpoint access section.

AWS-EKS-PUBLIC-PRIVATE!

On the next screen you can choose your favorite infra options or leave it off state.

Congratulations! You have created your EKS cluster.

EKS Node Group Creation

You have successfully deployed EKS but you need worker nodes. For this requirement you need to select Compute tab from your EKS dashboard and click the Add Node Group button.

AWS-EKS-NODE-CREATE!

After you select the name and Node IAM Role, click next and select the machine types and scaling configurations.

AWS-EKS-SCALE!

We need to select subnet and ssh options from the last screen.

AWS-EKS-NODE-SSH!

After a few seconds, the nodes will have been created and joined the master.

AWS & Eksctl Setup

If you want to control your cluster with kubectl you need aws cli. Ok but what is eksctl?

Ekscli is a simple CLI tool for creating clusters on EKS - Amazon's new managed Kubernetes service for EC2. It is written in Go, uses CloudFormation, was created by Weaveworks and it welcomes contributions from the community.

Why we did previous step? because i did want to explain what is under hood.

Let's install eksctl;

brew tap weaveworks/tap

To install;

brew tap weaveworks/tap

To update;

brew upgrade eksctl && brew link

Let's install awscli;

brew install awscli

Configuration

(I assume you have already installed kubectl if not click here)

In order to create a kubeconfig file we need to configure awscli

awscli configure

To create kubeconfig;

aws eks --region [your region code] update-kubeconfig --name [your cluster name]

After these steps you have successfully configured your kubectl.

AWS-EKS-KUBECTL!

After configured your awscli you can create a EKS cluster with ekscli :)

eksctl create cluster

eksctl read your awscli configuration and create a cluster for you with default settings.

The End

We completed EKS cluster installation. Feel free to discover your newly created EKS Cluster.

Comments