Create a Kubernetes cluster in AWS EKS from local terminal

Yakuphan
4 min readNov 11, 2023

--

First we need to configure AWS, for this we need access key id and secret access key. First, I will show you how to get it.

I recommend that you always create and use a user in our AWS console for security purposes. Now I will show you the steps one by one and how to get the AWS access key and id after creating the user.

First, we go to the iam console, click on users and click on create user.

Then we enter our username and other information.

Then we set the permission, I added it to the group to which I gave admin permission before. If you have not created a group, you can give it admin rights or whatever permissions you want.

When we create it correctly, we should see this green screen.

After creating the user, we click on the button at the top right and from there we need to click on security credentials.

Then we will create access id and access secret by clicking on access keys on this page.

Here we can choose CLI because we will try to connect from AWS CLI.

We will enter the necessary information here.

Here too, when we enter correctly, we should see this green screen. With this Download.csv file, we obtain the Access Key ID and Secret access key.

After obtaining this information and configuring AWS, we need to create eksctl and then we can start creating the Kubernetes cluster. Since I am using a Mac, I installed brew and installed eksctl with these commands. If brew is not installed, you can install it with the command below.

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

If you want to install eksctl from other systems, you can use this link.

We can see whether it is created by typing eksctl version.

We can create a simple kubernetes cluster by entering the following commands. If you want to make more settings, you can find the necessary information on this site. Here I just wanted to show you how to do it in a simple way.

eksctl create cluster \
--name my-cluster \
--region eu-central-1 \
--node-type t3.medium \
--nodes-min 2 \
--nodes-max 4

We can check whether it has occurred or not with the following command.

eksctl get cluster 

Congratulations , we have successfully created the Kubernetes cluster in AWS EKS from the local terminal using AWS CLI.

We can check whether our nodes are created or not. Now the Kubernetes cluster is ready, you can install any application you want.

kubectl get node 

If you are not going to use it anymore, you can delete the kubernetes cluster.

eksctl delete cluster my-cluster 

Thank you very much for reading. If you want to learn more AWS content or Kubernetes-related topics, you can also check out my other articles.

--

--

Yakuphan

Cloud/Devops Engineer/Terraform Certified / AWS Certified / Kubernetes Certified/ Aws Community Builder