Create your first EKS cluster using eksctl!
Creating EKS Cluster using commad line using eksctl
KUBERNETESDEVOPS


What is eksctl and why use it?
eksctl is a command-line tool specifically designed for creating and managing EKS clusters. It abstracts away much of the complexity involved in configuring the cluster manually. With a single command, you can create a fully functional EKS cluster with sensible defaults.
eksctl handles the entire setup process, including creating the necessary IAM roles, VPC (Virtual Private Cloud) configuration, and node groups. It automates many of the steps involved in setting up the infrastructure for an EKS cluster, saving time and effort.
Install eksctl
Installation on unix systems is very straight forward:
# for ARM systems, set ARCH to: `arm64`, `armv6` or `armv7`
ARCH=amd64
PLATFORM=$(uname -s)_$ARCH
curl -sLO "https://github.com/eksctl-io/eksctl/releases/latest/download/eksctl_$PLATFORM.tar.gz"
tar -xzf eksctl_$PLATFORM.tar.gz -C /tmp && rm eksctl_$PLATFORM.tar.gz
sudo mv /tmp/eksctl /usr/local/bin
Create cluster
Create an IAM Role for EKS:
Create an IAM role that Kubernetes can assume to manage AWS resources on your behalf. This role needs permissions to create and manage EC2 instances, IAM roles, and other resources. You can attach the "AmazonEKSClusterPolicy" and "AmazonEKSServicePolicy" managed policies to this role.
Create an EKS Cluster:
Use eksctl to create the EKS cluster. You'll need to specify parameters like the region, node instance type, and number of nodes. Please make sure that the host machine has required privileges attached or added. For example:
eksctl create cluster --name my-cluster --version 1.21 --node-type t3.medium --nodes 2 --region us-west-2 --node-private-networking --node-zones us-west-2a,us-west-2b
Configure kubectl to Interact with the Cluster:
After creating the cluster, eksctl automatically configures kubectl to use the new cluster. Verify the configuration using:
aws eks --region region update-kubeconfig --name my-cluster
Verify Cluster Creation:
Use kubectl to verify that your cluster is up and running:
kubectl get nodes
Delete cluster:
Use kubectl command "eksctl delete cluster --name my-cluster"
Congratulations on creating your first cluster using eksctl!!