Understanding EKS and How to Set Up an EKS Cluster
Raees Qazi | DevOps Engineer | Learner | Mentor | Creator | Briller Technologies

Kubernetes Basics
- Scheduler: Decides which Docker container runs on which pod within a worker node.
- kubectl: A command-line tool to control and manage the Kubernetes (K8s) cluster.
- eksctl: A tool specifically designed to manage Amazon EKS (Elastic Kubernetes Service) environments.
Key AWS Components
- ALB (Application Load Balancer): Manages incoming traffic and directs it to available worker nodes. If all worker nodes are busy, the master node will create a new worker node.
- VPC (Virtual Private Cloud): The environment where both worker nodes and the master node reside.
- IAM (Identity and Access Management): Controls access and permissions for users and resources.
- CF (CloudFormation): Automates the creation and deletion of AWS resources, including EKS clusters.
How AWS Services Work Together
The process of setting up an EKS cluster follows this hierarchy:
- EC2 (Instance where tools are installed)
- EKSCTL (A CLI tool to manage EKS)
- CloudFormation (Handles resource provisioning)
- EKS Cluster (Managed Kubernetes cluster)
We install AWS CLI and EKSCTL on an EC2 instance and then use eksctl to instruct CloudFormation to create an EKS cluster.
Setting Up an EKS Cluster Using eksctl
Pre-requisites:
- IAM User with access keys and secret keys.
- AWS CLI Installed and Configured:
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"sudo apt install unzipunzip awscliv2.zipsudo ./aws/installaws configure
3. Install kubectl (for managing Kubernetes clusters):
curl -o kubectl https://amazon-eks.s3.us-west-2.amazonaws.com/1.19.6/2021-01-05/bin/linux/amd64/kubectlchmod +x ./kubectlsudo mv ./kubectl /usr/local/binkubectl version --short --client
4. Install eksctl (for managing EKS clusters):
curl --silent --location "https://github.com/weaveworks/eksctl/releases/latest/download/eksctl_$(uname -s)_amd64.tar.gz" | tar xz -C /tmpsudo mv /tmp/eksctl /usr/local/bineksctl version
Steps to Create an EKS Cluster
- Create the EKS Cluster:
eksctl create cluster --name=my-cluster \--region=us-west-2 \--version=1.30 \--without-nodegroup
2. Associate IAM OIDC Provider:
eksctl utils associate-iam-oidc-provider \--region us-west-2 \--cluster my-cluster \--approve
3. Create a Node Group:
eksctl create nodegroup --cluster=my-cluster \--region=us-west-2 \--name=my-cluster \--node-type=t2.medium \--nodes=2 \--nodes-min=2 \--nodes-max=2 \--node-volume-size=29 \--ssh-access \--ssh-public-key=eks-nodegroup-key
Note: Ensure that the SSH public key eks-nodegroup-key is available in your AWS account.
4. Update kubectl Context:
aws eks update-kubeconfig--region us-west-2--name my-cluster
5. Delete the EKS Cluster (if needed):
eksctl delete cluster --name=my-cluster--region=us-west-2
This guide simplifies setting up an EKS cluster step by step. By following these steps, you can deploy and manage Kubernetes clusters efficiently on AWS.
Comments
Post a Comment