Kubernetes Application Deployment with AutoScaling & Helm on AWS EKS

Managing containerized applications at scale requires automation, resilience, and orchestration. Kubernetes is the de-facto standard for container orchestration, and combined with Helm, it becomes a powerful tool for deploying, managing, and scaling applications efficiently. This guide demonstrates deploying a sample application on AWS EKS with load balancing, persistent storage, and auto-scaling.


1️⃣ Prerequisites

  • AWS account with IAM permissions for EKS, EC2, and S3

  • kubectl installed locally

  • aws-cli configured

  • eksctl installed for EKS cluster creation

  • Helm installed locally


2️⃣ Create an EKS Cluster

Use eksctl to spin up a Kubernetes cluster:

eksctl create cluster \
  --name demo-cluster \
  --region us-east-1 \
  --nodes 3 \
  --node-type t3.medium \
  --managed

This creates:

  • 3 worker nodes

  • Managed node group

  • Default VPC and networking for the cluster

Verify cluster access:

kubectl get nodes

3️⃣ Deploy a Sample Application

Create a deployment.yaml for a simple Nginx application:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx-deployment
spec:
  replicas: 2
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: nginx:latest
        ports:
        - containerPort: 80

Create a service.yaml for LoadBalancer:

apiVersion: v1
kind: Service
metadata:
  name: nginx-service
spec:
  type: LoadBalancer
  selector:
    app: nginx
  ports:
    - protocol: TCP
      port: 80
      targetPort: 80

Apply the manifests:

kubectl apply -f deployment.yaml
kubectl apply -f service.yaml

Check the service external IP:

kubectl get svc nginx-service

4️⃣ Enable Horizontal Pod AutoScaling (HPA)

Create an HPA for CPU-based scaling:

kubectl autoscale deployment nginx-deployment \
  --cpu-percent=50 \
  --min=2 --max=5

Verify HPA:

kubectl get hpa

Now, the application will scale automatically based on CPU usage.


5️⃣ Add Persistent Storage

Create a Persistent Volume Claim (PVC) for storing application data:

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: nginx-pvc
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 5Gi

Mount the PVC in your deployment if needed by updating the deployment.yaml.


6️⃣ Deploy Using Helm

Helm allows templated, versioned deployments.

  1. Create a Helm chart:
helm create nginx-chart
  1. Update values.yaml with desired replicas, image, and service type.

  2. Install the chart:

helm install my-nginx nginx-chart
  1. Upgrade with new values:
helm upgrade my-nginx nginx-chart --set replicaCount=3

7️⃣ Monitoring and Scaling Verification

  • Use kubectl top pods to check resource usage.

  • Generate load to see HPA in action:

kubectl run load-generator --image=busybox -i -- /bin/sh
while true; do wget -q -O- http://nginx-service; done
  • Observe pods scaling up or down automatically.

✅ Key Takeaways

  • Kubernetes on EKS simplifies container orchestration with AWS-managed infrastructure.

  • AutoScaling ensures applications remain responsive under variable load.

  • Helm charts enable repeatable, maintainable, and versioned deployments.

  • Persistent storage and load balancers make applications production-ready.

  • Combining these tools results in scalable, resilient, and automated cloud-native deployments.


0
Subscribe to my newsletter

Read articles from Sayantan Samanta directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Sayantan Samanta
Sayantan Samanta