DEV Community

Cover image for EKS Cluster Setup, Deployment & LoadBalancer Exposure (Using eksctl) in Kubernetes
Krisha Arya
Krisha Arya

Posted on

EKS Cluster Setup, Deployment & LoadBalancer Exposure (Using eksctl) in Kubernetes

Overview

This practical demonstrates a complete end-to-end Kubernetes workflow on AWS EKS using eksctl from a Windows PowerShell environment.
The goal is to:

  • Create a new EKS cluster
  • Provision worker nodes
  • Deploy applications on Kubernetes
  • Expose the application to the outside world using a LoadBalancer
  • Perform complete cleanup to avoid AWS charges

This documentation is based on real execution logs and troubleshooting, not theoretical steps.

Prerequisites

  • Windows OS
  • PowerShell
  • AWS Account
  • AWS CLI installed
  • kubectl installed
  • eksctl installed

STEP 1: Verify eksctl Installation

eksctl version
Enter fullscreen mode Exit fullscreen mode

Output:

0.221.0
Enter fullscreen mode Exit fullscreen mode

✅ Confirms eksctl is installed and ready.

STEP 2: Configure AWS Credentials

aws configure
Enter fullscreen mode Exit fullscreen mode

Entered details:

  • AWS Access Key ID
  • AWS Secret Access Key
  • Default region: us-east-1
  • Output format: json

Sure 👍 here’s a clear, step-by-step guide to get AWS Access Key ID and Secret Access Key from the AWS Security (IAM) section.
This is exactly what you should write in documentation / practical files.

🔐 How to Get AWS Access Key ID & Secret Access Key (IAM)

Login to AWS Console

  1. Go to 👉 https://aws.amazon.com/console/
  2. Click Sign in to the Console
  3. Login using your AWS root account or IAM user

Open IAM (Security Service)

  1. In the AWS Console search bar, type IAM
  2. Open IAM – Identity and Access Management

👉 IAM is used to manage users, permissions, and access keys.

Go to Users

  1. In the left sidebar, click Users
  2. Click on your IAM User name

⚠️ Best practice:
Use an IAM user, not the root account, for CLI access.

Open Security Credentials

  1. Inside the user page, go to the Security credentials tab
  2. Scroll down to Access keys

Create Access Key

  1. Click Create access key
  2. Select Command Line Interface (CLI)
  3. Check the confirmation box
  4. Click Next
  5. (Optional) Add a tag
  6. Click Create access key

Copy Access Keys (VERY IMPORTANT)

You will see:

  • Access Key ID
  • Secret Access Key

⚠️ IMPORTANT RULES

  • Secret Access Key is shown ONLY ONCE
  • Copy and store it safely
  • If lost, you must create a new key

Example:

Access Key ID     : AKIAxxxxxxxxxxxx
Secret Access Key : xxxxxxxxxxxxxxxxxxxxxxxxx
Enter fullscreen mode Exit fullscreen mode

STEP 3: Verify AWS Identity

aws sts get-caller-identity
Enter fullscreen mode Exit fullscreen mode

Output:

{
    "UserId": "198961699878",
    "Account": "198961699878",
    "Arn": "arn:aws:iam::198961699878:root"
}
Enter fullscreen mode Exit fullscreen mode

✅ Confirms AWS authentication is working.

STEP 4: Verify Configured Region

aws configure get region
Enter fullscreen mode Exit fullscreen mode

Output:

us-east-1
Enter fullscreen mode Exit fullscreen mode

STEP 5: Create EKS Cluster with Managed Node Group

eksctl create cluster `
  --name my-cluster `
  --region us-east-1 `
  --nodegroup-name standard-workers `
  --node-type t3.medium `
  --nodes 3
Enter fullscreen mode Exit fullscreen mode

What this does:

  • Creates an EKS cluster named my-cluster
  • Uses Kubernetes version 1.32
  • Provisions 3 EC2 worker nodes
  • Installs core add-ons:

    • kube-proxy
    • CoreDNS
    • VPC CNI
    • metrics-server

⏱️ Cluster creation took ~15 minutes.

Final Status:

EKS cluster "my-cluster" in "us-east-1" region is ready
Enter fullscreen mode Exit fullscreen mode

STEP 6: Update kubeconfig for kubectl

aws eks update-kubeconfig --name my-cluster --region us-east-1
Enter fullscreen mode Exit fullscreen mode

Output:

Added new context arn:aws:eks:us-east-1:198961799878:cluster/my-cluster
Enter fullscreen mode Exit fullscreen mode

STEP 7: Verify Worker Nodes

kubectl get nodes
Enter fullscreen mode Exit fullscreen mode

Output:

ip-192-168-21-14.ec2.internal   Ready
ip-192-168-28-52.ec2.internal   Ready
ip-192-168-49-76.ec2.internal   Ready
Enter fullscreen mode Exit fullscreen mode

✅ All worker nodes are in Ready state.

STEP 8: Create ConfigMap (Application Configuration)

Initial PowerShell Multiline Error

Linux-style \ caused parsing errors in PowerShell.

Correct Command (Single Line)

kubectl create configmap app-config --from-literal=APPENV=production --from-literal=LOGLEVEL=info
Enter fullscreen mode Exit fullscreen mode

Output:

configmap/app-config created
Enter fullscreen mode Exit fullscreen mode

Verify ConfigMap

kubectl get configmap
kubectl describe configmap app-config
Enter fullscreen mode Exit fullscreen mode

STEP 9: Create Pod Using ConfigMap

Create YAML File

notepad config-pod.yaml
Enter fullscreen mode Exit fullscreen mode

config-pod.yaml

apiVersion: v1
kind: Pod
metadata:
  name: config-pod
spec:
  containers:
  - name: app
    image: nginx
    env:
    - name: APPENV
      valueFrom:
        configMapKeyRef:
          name: app-config
          key: APPENV
Enter fullscreen mode Exit fullscreen mode

Apply Pod

kubectl apply -f config-pod.yaml
Enter fullscreen mode Exit fullscreen mode

Verify Pod

kubectl get pods
kubectl exec -it config-pod -- printenv APPENV
Enter fullscreen mode Exit fullscreen mode

Output:

production
Enter fullscreen mode Exit fullscreen mode

STEP 10: Create Deployment (Multiple Replicas)

Create Deployment YAML

notepad nginx-deployment.yaml
Enter fullscreen mode Exit fullscreen mode

nginx-deployment.yaml

apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx-deployment
spec:
  replicas: 3
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: nginx:1.25
        ports:
        - containerPort: 80
Enter fullscreen mode Exit fullscreen mode

Apply Deployment

kubectl apply -f nginx-deployment.yaml
Enter fullscreen mode Exit fullscreen mode

Verify

kubectl get deployments
kubectl get pods
Enter fullscreen mode Exit fullscreen mode

STEP 11: Expose Deployment Using LoadBalancer

kubectl expose deployment nginx-deployment --type=LoadBalancer --port=80
Enter fullscreen mode Exit fullscreen mode

Verify Service

kubectl get svc
Enter fullscreen mode Exit fullscreen mode

Output:

nginx-deployment   LoadBalancer   a26036e6e746042178d8b53a365c218b.us-east-1.elb.amazonaws.com
Enter fullscreen mode Exit fullscreen mode

✅ AWS Elastic Load Balancer was created automatically.

STEP 12: Cleanup Kubernetes Resources

kubectl delete deployment nginx-deployment
kubectl delete svc nginx-deployment
kubectl delete pod config-pod
kubectl delete configmap app-config
Enter fullscreen mode Exit fullscreen mode

Verify Cleanup

kubectl get all
Enter fullscreen mode Exit fullscreen mode

Output:

service/kubernetes (default system service only)
Enter fullscreen mode Exit fullscreen mode

STEP 13: Delete EKS Cluster (MOST IMPORTANT)

eksctl delete cluster --name my-cluster --region us-east-1
Enter fullscreen mode Exit fullscreen mode

What this deletes:

  • Worker nodes
  • EKS control plane
  • Load balancers
  • CloudFormation stacks
  • Networking resources

Final Status:

all cluster resources were deleted
Enter fullscreen mode Exit fullscreen mode

Conclusion

This practical successfully demonstrated:

  • EKS cluster creation using eksctl
  • Managed worker node provisioning
  • ConfigMap creation and usage
  • Pod and Deployment lifecycle
  • External access using LoadBalancer
  • Complete and safe cleanup to avoid AWS charges

Stay connected for next kubernetes tutorial! 😊

Top comments (0)