Amazon EKS — Cluster Creation Hands-On Lab

2 minute read

In this lab, you’ll create an EKS cluster using eksctl, verify it works, deploy a test application, and clean up.


Lab Objectives

  • Create an EKS cluster with a managed node group
  • Configure kubectl access
  • Deploy a sample application
  • Verify the deployment
  • Clean up all resources

Prerequisites

Ensure the following tools are installed:

aws --version          # AWS CLI v2
eksctl version         # eksctl
kubectl version --client  # kubectl

Confirm your AWS identity:

aws sts get-caller-identity

Step 1 — Create the Cluster

Create a simple EKS cluster with 2 worker nodes:

eksctl create cluster \
  --name eks-lab-cluster \
  --region us-east-1 \
  --version 1.29 \
  --nodegroup-name lab-nodes \
  --node-type t3.medium \
  --nodes 2 \
  --nodes-min 1 \
  --nodes-max 3 \
  --managed

Expected Duration: 15-20 minutes

While waiting, eksctl creates:

  1. A VPC with public and private subnets
  2. NAT Gateway and Internet Gateway
  3. IAM roles for cluster and nodes
  4. The EKS cluster
  5. A managed node group with 2 nodes
  6. Updates your kubeconfig automatically

Step 2 — Verify the Cluster

# Check cluster status
eksctl get cluster --region us-east-1

Expected output:

NAME              REGION      EKSCTL CREATED
eks-lab-cluster   us-east-1   True
# Check nodes
kubectl get nodes

Expected output:

NAME                             STATUS   ROLES    AGE   VERSION
ip-192-168-1-100.ec2.internal   Ready    <none>   5m    v1.29.x
ip-192-168-2-200.ec2.internal   Ready    <none>   5m    v1.29.x
# Check system pods
kubectl get pods -n kube-system

You should see CoreDNS, kube-proxy, and VPC CNI pods running.


Step 3 — Deploy a Test Application

Create a simple nginx deployment:

# Create a namespace
kubectl create namespace lab-test

# Deploy nginx
kubectl create deployment nginx \
  --image=nginx:latest \
  --replicas=2 \
  --namespace=lab-test

# Expose as a LoadBalancer service
kubectl expose deployment nginx \
  --port=80 \
  --type=LoadBalancer \
  --namespace=lab-test

Step 4 — Verify the Deployment

# Check pods
kubectl get pods -n lab-test

Expected:

NAME                     READY   STATUS    RESTARTS   AGE
nginx-7c5ddbdf54-abc12   1/1     Running   0          30s
nginx-7c5ddbdf54-def34   1/1     Running   0          30s
# Check the service (wait 2-3 minutes for the ELB to provision)
kubectl get svc -n lab-test

Expected:

NAME    TYPE           CLUSTER-IP     EXTERNAL-IP                                    PORT(S)        AGE
nginx   LoadBalancer   10.100.1.100   a1b2c3d4e5-1234567890.us-east-1.elb.amazonaws.com   80:31234/TCP   2m
# Test the application
curl http://<EXTERNAL-IP>

You should see the nginx welcome page HTML.


Step 5 — Explore the Cluster

# Cluster info
kubectl cluster-info

# Describe a node
kubectl describe node <node-name>

# Check resource usage
kubectl top nodes    # (requires metrics-server)
kubectl top pods -n lab-test

# View cluster events
kubectl get events -n lab-test --sort-by='.metadata.creationTimestamp'

# Check EKS add-ons
aws eks list-addons --cluster-name eks-lab-cluster --region us-east-1

Step 6 — Clean Up

Delete the test resources first, then the cluster:

# Delete the test namespace and all resources in it
kubectl delete namespace lab-test

# Wait for the LoadBalancer to be deprovisioned
sleep 30

# Delete the entire cluster
eksctl delete cluster --name eks-lab-cluster --region us-east-1

Expected Duration: 5-10 minutes for cleanup.

Important: Always delete the cluster when done to avoid charges. An EKS cluster costs $0.10/hr ($2.40/day) plus EC2 costs.


Lab Summary

Step Action Verification
1 Created EKS cluster eksctl get cluster
2 Verified nodes kubectl get nodes
3 Deployed nginx kubectl get pods -n lab-test
4 Exposed service curl <EXTERNAL-IP>
5 Explored cluster kubectl describe, kubectl top
6 Cleaned up eksctl delete cluster

What’s Next?

Test your cluster creation knowledge with practice questions.

Next: Practice Questions →

Updated: