A Comprehensive Guide to Creating and Interacting with Amazon EKS Clusters

Dhruv KaushikDhruv Kaushik
4 min read

TL;DR

This is a step-by-step guide to creating and interacting with Amazon EKS clusters using kubectl. It covers everything you need to know, from the prerequisites to the required steps and configuration options for setting up the cluster.

Introduction

Amazon Elastic Kubernetes Service (EKS) is a managed service that simplifies running Kubernetes on AWS by eliminating the need to install and operate your own Kubernetes control plane or nodes. In this guide, we will walk you through the process of creating an EKS cluster and using the AWS CLI and kubectl to interact with it.

Prerequisites

  1. An AWS account with appropriate permissions to create IAM roles, EKS clusters, etc.

  2. kubectl installed to interact with the cluster.

  3. AWS CLI installed and authorized

Creating the Cluster

Step 1: Login to your AWS account

Step 2: Search for EKS and hit “enter”

Step 3: Click on “Create Cluster”

Now from here there are 2 options to configure, quick configuration and custom configuration

Quick Configuration

This is a new feature that let’s you create the cluster with minimal config. This includes:

  • Application load balancing

  • Block Storage

  • Compute Autoscaling

  • GPU support

  • Cluster DNS

  • Pod and service networking

In a nutshell, Amazon manages everything for you including setting up the load balancers, logs, networks, etc.

Step 4: Select “quick configuration” from the "Configuration Options"

Step 5: After filling out the form, it should look something like this

Note that there might not be “roles” if you didn’t make any before. In that case, just click on the button next to the field that says “Create recommended role”. Keep the default options and create. Hit the refresh button next to the form field in case it does not automatically fetch it.

Step 6: Click on create cluster and give it some time to get things ready.

Notice the dropdown at the end of the form that says "View quick configuration defaults", this gives you a summary of the things that AWS will set up.

This should be the best option if you're just starting out or want to quickly create the cluster. You do not need to configure any nodes/node group. All of that will be managed by AWS. After creating the cluster using the "quick configuration", configure the kubectl to start interacting with your cluster

Custom Configuration

This involves configuring the compute, networking, api’s manually. To use this option:

Step 4: Select the “custom configuration” from “Configuration options”

Step 5: Opt out of the “Auto Mode”

Switching to the Auto Mode would mean that AWS will be managing the compute like the “Quick configuration”. Use this option when you only wanted to configure the add-ons/metrics/logs and don’t want to manually configure the compute.

Step 6: Give a name to your cluster and assign the role. Use the “Create recommended role” button to create one if you don’t have it already. Stick to the default options and create.

If you need a guide on creating a role, go to "Step 10."

Step 7: Keep navigating to the “next” page unless you want you change any of the default options as per your requirement.

Step 8: Click on “create” to start the cluster creation.

Because we opted out of the “auto mode”, we will have to create the compute ourselves.

Once the cluster is created, head over to he dashboard of your cluster and go to the “Compute” tab. Here we will create a node group.

Step 9: Name your node group.

Step 10: Create a new IAM role if not already present. Click on the “create recommended role” button next to it. Select the entity type and use case. Click on “next”.

Step 11: Note that it already selected the required policies. Click on “next” to review

Step 12: Give a name to the role. Ensure that these policies are the ones that were selected. Once ensured, click on “create role”.

Step 13: Return to the page where we were adding the node group. Refresh the roles if required. Select the role you just created. Click on “next”.

Step 14: Adjust the options to your need or let them stay as defaults.

Step 15: Click on “next”. Review the subnet information and change as required. The defaults should be good enough. Click on “next”.

Step 16: Review the information and click “create” to implement the node group.

Great, you have successfully created a cluster and attached a node group to it for the compute.

Accessing your EKS cluster

Step 1. If you’re a Linux/Mac user, open Terminal. If you’re a windows user, open Command Prompt(cmd)

Step 2. Type the following command aws eks update-kubeconfig --name <my-eks-cluster-name> and hit "Enter".

Don't forget to replace the placeholder with your actual cluster name.

Notice how it indicates that the context has been updated. You can now use your kubectl as usual, and it will interact with your Amazon EKS.

Before you go...

Thanks for sticking around till the end — hope you found something valuable in here! Got a question? Just want to chat? Reach out to me on twitter or linkedin

0
Subscribe to my newsletter

Read articles from Dhruv Kaushik directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Dhruv Kaushik
Dhruv Kaushik