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
Copy 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
eksctl: command not found
Run export PATH=$PATH:/usr/local/bin or move eksctl to /usr/bin/.
eksctl version shows an old version
Run which eksctl to check the location and update it.
Commands
Copy 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
Common Issues & Solutions
Reinstall using curl or apt install awscli.
The config profile does not exist
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)
Common Issues & Solutions
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
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
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
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
Service pending external IP
AWS Load Balancer controller missing.
Install ALB Ingress Controller or use --type=NodePort.
Scale the node group: eksctl scale nodegroup --cluster=my-cluster --name=my-nodes --nodes=2.
Step 6: Enable Cluster Autoscaler
Commands
Common Issues & Solutions
Cluster autoscaler not scaling
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
Error deleting cluster: VPC not deleted
Manually delete the VPC from AWS Console.
Detach all policies before deleting.
✅ Cluster Created
✅ Worker Nodes Added
✅ Sample App Deployed
✅ Autoscaler Configured
✅ Cluster Deleted When Done
Last updated 11 months ago