🌐 Starting from scratch: Setting up an Amazon EKS Cluster. Join me on this journey into the world of Kubernetes on AWS! 🚀
Tags: devops, beginners, cloud, kubernetes
Published: 2023-11-24 04:50:51

**Hello There!!!**
Called Sarvar, I am an Enterprise Architect, Currently working at Deloitte. With years of experience working on cutting-edge technologies, I have honed my expertise in Cloud Operations (Azure and AWS), Data Operations, Data Analytics, and DevOps. Throughout my career, I’ve worked with clients from all around the world, delivering excellent results, and going above and beyond expectations. I am passionate about learning the latest and treading technologies.

You should be aware of the topic of this article. Yes, this article is about how to create Amazon EKS cluster using EKSCTL tool. We’ll go over how to create an AWS EKS cluster using the EKSCTL command, as well as other commands that are available and their options. Without further ado, let’s get going.

## Prerequisites:
**AWS CLI (Command-Line Interface) —** Please follow the link to install and configure on your local machine. [link](https://medium.com/@sarvar04/configure-eksctl-kubectl-aws-cli-on-amazon-linux-2-6efc3e166dbc)
**Kubectl (Kubernetes CLI) —** Please follow the link to install and configure on your local machine. [link](https://medium.com/@sarvar04/configure-eksctl-kubectl-aws-cli-on-amazon-linux-2-6efc3e166dbc)
**EKSCTL (AWS EKS CLI) —** Please follow the link to install and configure on your local machine. [link](https://medium.com/@sarvar04/configure-eksctl-kubectl-aws-cli-on-amazon-linux-2-6efc3e166dbc)

## What is EKSCTL?
AWS (Amazon Web Services) offers the command-line utility EKSCTL for controlling clusters of the Amazon EKS (Elastic Kubernetes Service). By offering an easy-to-use interface for typical activities, it streamlines the process of setting up, running, and scaling Kubernetes clusters on AWS.
With EKSCTL, you can manage add-ons, upgrade Kubernetes versions, scale node groups, manage worker nodes, construct and manage EKS clusters, and carry out other cluster management operations from the command line. By automating many tasks that would normally need manual configuration and communication with numerous AWS services, EKSCTL simplifies the complexity of setting up and managing EKS clusters.

To provide a seamless management experience for EKS clusters in AWS environments, EKSCTL also interfaces with other AWS services, including AWS CloudFormation, AWS Identity and Access Management (IAM), and Amazon EC2 Auto Scaling.

## EKSCTL Administrative Commands -
EKSCTL’s extensive set of commands makes it feasible to administer EKS (Elastic Kubernetes Service) clusters. Some of the most frequent EKSCTL commands are as follows:

**_eksctl create cluster:_** Creates a new EKS cluster with the provided specifications, including the cluster name, region, node groups, and networking options, using the eksctl create cluster command.
**_eksctl delete cluster:_** EKS clusters can be deleted with the eksctl delete cluster command, along with any related resources such as worker nodes, VPCs, and security groups.
**_eksctl scale nodegroup:_** By adjusting the number of worker nodes, the eksctl scale nodegroup command scales a particular node group’s size within an EKS cluster.
**_eksctl upgrade cluster:_** Manages the upgrade process for worker nodes automatically while upgrading the Kubernetes version of an existing EKS cluster to a given version.
**_eksctl update kubeconfig:_** Using eksctl update kubeconfig, you can prepare your machine’s local kubeconfig file for usage with kubectl by updating it with the settings required to connect to an EKS cluster.
**_eksctl get cluster:_** Gets details about an existing EKS cluster, including its status, region, VPC setup, and node groups, using the eksctl get cluster command.
**_eksctl create nodegroup:_** Using the eksctl create nodegroup command, you can add more worker nodes with particular specifications, such as instance type, auto scaling group settings, and IAM roles, to an existing EKS cluster.
**_eksctl delete nodegroup:_** Using the eksctl delete nodegroup command, you can remove a particular node group from an EKS cluster together with all of its worker nodes and resources.
**_eksctl create fargateprofile:_** You can run containers utilizing Fargate as a compute option by using the eksctl build fargateprofile command to create an Amazon Fargate profile within an EKS cluster.
**_eksctl update nodegroup:_** Updates the configuration of a particular node group inside an EKS cluster, such as altering the instance type, intended capacity, or other variables, using the eksctl update nodegroup command.
**_eksctl describe nodegroup:_** A node group’s status, instance types, and auto scaling group settings may all be found out in detail by using the eksctl describe nodegroup command.

These are just a few of the frequently used commands that EKSCTL offers. EKSCTL also provides a large number of other commands for managing various EKS cluster components, such as networking, authentication, add-ons, and more. The official EKSCTL documentation has a detailed description of all the commands that are currently supported and how to use them.

## EKSCTL Commands Flags/Options -
EKSCTL commands often have a number of options that let you alter how the command behaves. You can use the following options with EKSCTL commands:

**_--region:_** Specifies the AWS region where the EKS cluster or other resources should be created or managed.
**_--name:_** Specifies the name of the EKS cluster or other resources to be created, managed, or updated.
**_--nodegroup-name:_** Specifies the name of the node group within an EKS cluster for node group-related commands.
**_--nodes:_** Specifies the number of worker nodes to be created or managed in a node group.
**_--instance-types:_** Specifies the EC2 instance types to be used for worker nodes in a node group.
**_--ami-family:_** Specifies the Amazon Machine Image (AMI) family to be used for worker nodes.
**_--kubeconfig:_** Specifies the path to the kubeconfig file that EKSCTL should use for authentication and communication with the EKS cluster.
**_--ssh-public-key:_** Specifies the public SSH key to be used for worker nodes for SSH access.
**_--tags:_** Specifies tags to be applied to resources created or managed by EKSCTL, such as nodes, security groups, or other resources.
**_--managed:_** Specifies that the node group should be managed by EKSCTL, allowing EKSCTL to automatically manage the scaling, rolling updates, and other operations of the node group.
**_--node-private-networking:_** Specifies whether to use private networking for worker nodes, which means that worker nodes will not have public IP addresses.
**_--asg-desired-capacity:_** Specifies the desired capacity of the Amazon EC2 Auto Scaling group for a node group.
**_--update-auth:_** Specifies whether to update the Kubernetes auth ConfigMap to grant or revoke permissions for a user or group to access the EKS cluster.

It usually takes a few steps to set up a production-grade EKS cluster on AWS using EKSCTL. Here is a comprehensive example command for setting up an EKS cluster with configurations suitable for production use:

## Create AWS EKS Cluster Using EKSCTL -
An Amazon Elastic Kubernetes Service (EKS) cluster with the following configuration is being created in the us-west-2 region using this command and the “eksctl” tool.

**The following activity are Actually thing we are doing with EKSCTL**

Cluster name: “my-eks-cluster”.
Kubernetes version: 1.20.
Nodegroup name: “my-nodegroup”.
Node type: t3.small.
Number of nodes: 3.
Nodes are in a private network.
Nodes are distributed across two availability zones: us-west-2a and us-west-2b.
The cluster has the tag “environment=production”.
The cluster is managed by AWS (rather than self-managed).
The desired capacity of the associated Auto Scaling Group is 3.
The public key for SSH access to the nodes is “my-public-key”.
A timeout of 30 minutes is set for the creation process.

```
eksctl create cluster \
--name my-eks-cluster \
--version 1.20 \
--region us-west-2 \
--nodegroup-name my-nodegroup \
--node-type t3.small \
--nodes 3 \
--node-private-networking \
--node-zones us-west-2a,us-west-2b \
--tags environment=production \
--managed \
--asg-desired-capacity 3 \
--ssh-public-key my-public-key \
--timeout=30m
```

_**Conclusion:** EKSCTL is a powerful and convenient tool for managing EKS clusters, enabling users to creating , deleting, managing, monitoring and scaling up and down Kubernetes clusters on AWS with ease and efficiency._
— — — — — — — —

**Here is the End!**

Thank you for taking the time to read my article. I hope you found this article informative and helpful. As I continue to explore the latest developments in technology, I look forward to sharing my insights with you. Stay tuned for more articles like this one that break down complex concepts and make them easier to understand.

_Remember, learning is a lifelong journey, and it’s important to keep up with the latest trends and developments to stay ahead of the curve. Thank you again for reading, and I hope to see you in the next article!_

_**Happy Learning!**_