Create Kubernetes Cluster on Amazon EKS ☸️

Image for post
Image for post

What is EKS❓

AWS EKS is a Managed Kubernetes Service from Amazon, which means AWS manages the Master Nodes for you. All the necessary applications/services are already pre-installed like the container runtime or master processes, and besides, it also takes care of scaling and backups. 👍 You only create the Worker Nodes.

How to use EKS ❓

To create a K8s cluster in EKS, you need to do the following steps:

  1. Setup or preparation steps
  • create AWS account
  • create a VPC
  • virtual private space
  • create an IAM role with Security Group (or in other words: create AWS user with a list of permissions)

2. Create Cluster Control Plane

  • Master Nodes
  • choose necessary information like cluster name and k8s version
  • select region and VPC for your cluster
  • set security

3. Create Worker Nodes and connect to cluster The Worker Nodes are some EC2 instances with CPU and storage resources.

  • Create as a Node Group
  • Choose cluster it will attach to
  • Define Security Group, select instance type etc. With NodeGroup you have autoscaling, which means based on your needs depending on how much load the cluster has new Worker Nodes will automatically be added or removed in the cluster.
  • For that, you need to define the max and minimum number of Nodes.

We need to download eksctl and AWS CLI 👩‍💻

https://docs.aws.amazon.com/eks/latest/userguide/getting-started-eksctl.html

for mac, it’s just a simple

now we need to configure awscli with your AWS account

you will get something like, for which you have to enter your details

Now let’s create a cluster by

In this, we are creating a cluster with name cluster-name and defining the version, region, node group’s name, node type, and number of nodes

This will take a while to process, wait ⏳ till it’s over

after this is over your last line will look something like this

if you go to your EKS panel in AWS web console, you can see this

to see the nodes which are present, we can hop over to EC2 and take a look at what is present there

there are to worker nodes as we declared in the previous cmd

See this line to view your kube config file, and now all your kubectl command will run form the AWS EKS console

let’s try

you will get the output of the worker nodes present in the AWS ec2

if you were able to get up to this point, then it means you were able to create an EKS cluster and assign worker nodes to AWS

Congratulation 🥳 after this point we can deploy Kubernetes as we do locally

if you want help on how to deploy full-stack application check out my other article

Now we can delete the cluster by the following command

you will see this

Conclusion 🤠

eksctl is a simple CLI tool designed to build clusters on EKS. You build a cluster in minutes using only one instruction. I am a big fan of learning the principles of how a technology works, but if there are tools that make it much easier to work with the technology than I like using them. Typically the culture, which specialises in this technology, builds certain resources. So it’s smart to use this

P.S

feel free to reach out to me anytime 😃

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store