Create an EKS Cluster in under 5 minutes

AWS is one of the most popular cloud platforms which has tons of services for different use cases and Elastic Kubernetes Service is just one of those many services.

What is EKS?

EKS is the Kubernetes Service for Amazon. Elastic Kubernetes Service is a managed Kubernetes cluster which means AWS manages the master nodes for you. It will create the master nodes, install all the necessary applications on them like container runtime, Kubernetes master processes, scaling your cluster, and providing backups. This means you only create and worry about the worker nodes.

Amazon Elastic Kubernetes Service is a highly available, scalable, and secure Kubernetes Service.

AWS EKS provides managed Kubernetes master nodes and in AWS EKS:

  • There are no master nodes to manage.
  • The master nodes are multi-AZ to provide redundancy.
  • The master nodes will scale automatically when necessary.
  • If you run your own Kubernetes Cluster, you would have to scale it when having more worker nodes.
  • AWS EKS is secure by default and integrates with IAM.

Prerequisites

If you have your AWS Account and EKSCTL installed on your local machine you can head over to the demo here

How to use EKS?

If you or your organization have a small project and you want to run managed Kubernetes, you will need to create your cluster with EKS through the following steps:

  1. Create an AWS Account (free tier). AWS has a free tier account for one year if you are a new user.

2. Create a VPC. A VPC is your virtual private space in AWS where you can create your connections, configure security groups, add scaling groups and Network load balancers.

3. Create an IAM role with your security group. This means you have to create an AWS user with a list of permissions to manage EKS services.

4. After you are done with the steps above, you can create the Cluster Control Plane which means you can create your clusters with an AWS IAM role. When creating your cluster you will also need to prepare some basic information like

  • The name of your cluster and what Kubernetes version you want to use.
  • A region and VPC for your cluster.


You will then need to create Worker Nodes and connect to your cluster: When creating your cluster you can do it using the AWS UI, management console or you can use the command line. Once AWS creates the master nodes, you have to create the worker nodes and connect them to your cluster. On AWS, these worker nodes will be some EC2 Instances with certain CPU, RAM, and storage resources.

Your worker nodes will be created as Node groups and added to your Cluster. When you create a node group you will select the cluster that will be attached to it. You also define security groups, select the instance type and resources.

When you create your worker nodes, they will automatically be added or removed from the cluster to avoid that you have to define your maximum and minimum number of nodes i.e. your maximum number of nodes it should scale up to and minimum number of nodes it should scale down to.

Once you create your node group, you will have your worker nodes connected to the cluster and you can also access your cluster from your local machine. This will let you deploy your applications from your laptop or local machine using kubectl

There’s an easy way to simplify this process of creating a cluster on AWS much faster and more efficiently without having to do all the processes we listed above manually. We can do that with a command-line tool called EKSCTL

It is not an AWS tool, it’s from Weaveworks and has a lot of contributors from the community.

In this demo, we are going to create a Kubernetes Cluster using this EKS control tool. The advantage of using the EKS control tool is that instead of going through all the steps we mentioned above in creating your services and configuring all your resources manually either on your AWS management console or on the command line, instead we are going to execute one single EKS control command that will configure all the processes in the background for you.

DEMO: Creating Amazon EKS Cluster using EKSCTL

  1. Firstly, you will need to install EKS control, but before you do this, you have to download the Weaveworks homebrew tap using brew tap weaveworks/tap

2. Install the EKS control with brew install weaveworks/tap/eksctl

3. Confirm if it was successfully installed by typing eksctl version in your terminal.

4. The EKS control command has to connect and authenticate with AWS in order to create the cluster. This means before you can execute this command you have to have your AWS user credentials locally stored in your path at ~/.aws/credentials or you can directly login to your AWS account from your terminal by typing aws configure it will ask for your access key and secret key.

Your access key and secret key can be created from the IAM control plane on your AWS console.

5. Next, create a cluster using the EKS control on your terminal or command line.

eksctl create cluster (this command would create a cluster with all the defaults but you can override all multiple values using parameters)

6. Override all values like name, version, region using parameters. You can also create worker nodes that are created in a group.

eksctl create cluster \
--name my-cluster \
--version 1.19 \
--region eu-central-1 \
--nodegroup-name my-nodes \
--node-type t2.micro \
--nodes 2

When you execute the command, you will see a lot of configurations and resources being created directly in your terminal. It will create your cluster, subnets, vpc, etc. You have to wait a little bit until the process is over.

The command above gets executed with the AWS user credentials that you stored locally. You will be able to access the cluster and make changes later on.

  • You can see that the cluster has been created with the node groups.

  • The Cloudformation stack creates your AWS EKS resources, you can visit the Cloudformation console to confirm.

  • Visit your AWS console to see that your cluster has been created, and it’s now accessible. You can also check your EC2 instances too on the AWS console.
  • You can also see an overview of your Cluster resources.

  • When you create your cluster, a kubeconfig file is generated for you. It’s a file that has information about your cluster so that kubectl on your local machine can connect to that remote cluster. It will include the endpoint of the cluster, your certificate, and other information.
  • Get your worker nodes using kubectl get nodes

Note:- If you are done with the cluster, you can delete the cluster to avoid additional costs from AWS.

eksctl delete cluster –name my-cluster

Back in your console, you will see that your Cluster is deleted and your servers are also terminated.

  • EKS control is great for creating a cluster on EKS but if you will be managing several clusters or just prefer an advanced graphical control plane to help you manage your multiple clusters, track delivery across your EKS resources, create an event-driven workflow for all your tooling faster, and customize specific CI/CD for build, test, and release CTO.ai provides you with these awesome features all in one place.

Using the EKS control tool makes it super easy to create and deploy Kubernetes clusters on AWS EKS.


CTO.ai control plane solves these Kubernetes operations pain points by providing a simplified management across all your EKS workloads and clusters.

You can visit our website to get started or you can also sign up on our platform, or request a demo here.

If you have specific questions or issues configuring the file, I’d love to hear about them. Contact us here or ask a question in the CTO.ai Community!

You can also follow us on Twitter and on our blog. And if you’ve enjoyed this post, please, take a second to share it on Twitter.