eksctl

Task 2: Deploying a Kubernetes Cluster Using eksctl

eksctl is the easiest way to create and manage an Amazon EKS cluster. It automates creating EKS control planes, worker nodes, IAM roles, and networking.


Step 1: Install eksctl

Commands

curl -sSL "https://github.com/weaveworks/eksctl/releases/latest/download/eksctl_$(uname -s)_amd64.tar.gz" | tar xz -C /usr/local/bin
eksctl version

Common Issues & Solutions

Issue
Cause
Solution

eksctl: command not found

Path issue.

Run export PATH=$PATH:/usr/local/bin or move eksctl to /usr/bin/.

eksctl version shows an old version

Older binary in path.

Run which eksctl to check the location and update it.


Step 2: Install AWS CLI & Configure Credentials

Commands

curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip && sudo ./aws/install
aws configure
  • Enter AWS Access Key & Secret Key

  • Region (e.g., us-east-2)

  • Output format (json)

Common Issues & Solutions

Issue
Cause
Solution

aws: command not found

AWS CLI not installed.

Reinstall using curl or apt install awscli.

The config profile does not exist

Incorrect profile name.

Run aws configure list to check.


Step 3: Create an EKS Cluster

Command

This command:

  • Creates an EKS control plane in us-east-2

  • Adds 2 worker nodes (autoscaling between 1-3 nodes)

  • Uses t3.medium instances

Common Issues & Solutions

Issue
Cause
Solution

Cannot create cluster, IAM role is missing

IAM permissions are insufficient.

Attach AdministratorAccess or AmazonEKSFullAccess policy to the AWS user.

AWS IAM Authenticator not found

Missing dependency.

Install it: curl -o aws-iam-authenticator https://amazon-eks.s3.amazonaws.com/1.19.6/2020-11-02/bin/linux/amd64/aws-iam-authenticator && chmod +x aws-iam-authenticator && mv aws-iam-authenticator /usr/local/bin/.

Cluster creation takes too long

VPC misconfiguration.

Specify a custom VPC using --vpc-private-subnets or ensure your region has available subnets.

Error from server (Unauthorized)

Kubectl is not authorized to access EKS.

Update ~/.kube/config: aws eks update-kubeconfig --region us-east-2 --name my-cluster.


Step 4: Verify Cluster & Node Status

Commands

Common Issues & Solutions

Issue
Cause
Solution

nodes NotReady

Cluster is still provisioning.

Wait a few minutes and check kubectl get nodes.

Error from server (Forbidden)

IAM role does not have eks:DescribeCluster permission.

Attach AmazonEKSClusterPolicy to the role.


Step 5: Deploy a Sample App

Commands

Common Issues & Solutions

Issue
Cause
Solution

Service pending external IP

AWS Load Balancer controller missing.

Install ALB Ingress Controller or use --type=NodePort.

Pods stuck in Pending

No nodes available.

Scale the node group: eksctl scale nodegroup --cluster=my-cluster --name=my-nodes --nodes=2.


Step 6: Enable Cluster Autoscaler

Commands

Common Issues & Solutions

Issue
Cause
Solution

Cluster autoscaler not scaling

IAM permissions missing.

Attach AmazonEKSClusterAutoscalerPolicy to worker nodes.

Insufficient capacity error

AWS region has no free capacity.

Change instance type in eksctl scale nodegroup.


Step 7: Delete the Cluster

Command

Common Issues & Solutions

Issue
Cause
Solution

Error deleting cluster: VPC not deleted

EKS leaves VPC intact.

Manually delete the VPC from AWS Console.

IAM role deletion failed

Role is still in use.

Detach all policies before deleting.


Summary

Cluster CreatedWorker Nodes AddedSample App DeployedAutoscaler ConfiguredCluster Deleted When Done


Next Task: Do you want to set up EKS with Terraform or move to another Kubernetes admin task? 😊

Last updated