DEV Community

Cover image for The Fun Kubernetes: Launch Your First Kubernetes App on Amazon EKS

The Fun Kubernetes: Launch Your First Kubernetes App on Amazon EKS

In my previous post here, you will find a quick guide and hands-on guide on how to quickly experiment with Kubernetes on a local setup - which can also help you understand the basics of deployments and services.

Now, it's time to take the same application into the real world - by running it on Amazon Elastic Kubernetes Service (EKS), a managed Kubernetes platform designed for production use.
This guide will walk you through deploying that same app on EKS with beginner-friendly explanations at every step.

This guide will walk you through deploying that same app on EKS with beginner-friendly explanations at every step.

Why use Amazon EKS

why eks

Step 1: Create an EKS Cluster Using eksctl
eksctl is the easiest tool to set up a new EKS cluster. It abstracts away complex manual configurations.
a. Install eksctl (macOS)

brew tap weaveworks/tap
brew install weaveworks/tap/eksctl
Enter fullscreen mode Exit fullscreen mode

For Windows or Linux, use the installation guide https://eksctl.io

b. Create your Cluster
Just before you create your cluster, lets understand what's happening here (see the below code block)
--name: This is the name of your Kubernetes cluster.
--region: AWS region to deploy to.
--nodegroup-name: Name of the group of worker nodes.
--node-type: Specifies the EC2 instance type (e.g. t3.medium is a good general-purpose type).
--nodes: Number of worker nodes to start with.
--managed: Lets AWS manage the worker nodes for you (recommended).Run the below code, it should take about 10-20 minutes to provision the Kubernetes control plane and worker EC2 nodes.

eksctl create cluster \
  --name fun-k8s-cluster \
  --region us-east-1 \
  --nodegroup-name linux-nodes \
  --node-type t3.medium \
  --nodes 2 \
  --nodes-min 1 \
  --nodes-max 3 \
  --managed
Enter fullscreen mode Exit fullscreen mode

Step 2: Connect to the Cluster with kubectl
Once the cluster is ready, we need to configure kubectl (the Kubernetes CLI tool) to talk to it.

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

This command retrieves your new cluster's details and saves them to your kubeconfig file, enabling kubectl to locate and communicate with the cluster.

kubectl get nodes
Enter fullscreen mode Exit fullscreen mode

The expected output should look like this:

NAME                         STATUS   ROLES    AGE   VERSION
ip-192-168-xx-xx.ec2.internal   Ready    <none>   5m    v1.29
Enter fullscreen mode Exit fullscreen mode

Your worker nodes should appear listed with a status of Ready

Step 3: Deploy your app to EKS

Time to unleash your app on EKS! We’ll deploy it using Kubernetes manifest files-smooth, scalable, and seriously powerful. Let’s go!

🧱 deployment.yaml

  • Just before you create the deployment.yaml, lets understand what's happening here (see the below code block)
  • Deployment: Tells Kubernetes to keep N copies (replicas) of your app running.
  • replicas: 2: Runs two identical pods for high availability.
  • image: Replace with your actual Docker Hub image name.
  • containerPort: Port inside the container where your app runs (e.g., 8080).
apiVersion: apps/v1
kind: Deployment
metadata:
  name: my-app
spec:
  replicas: 2
  selector:
    matchLabels:
      app: my-app
  template:
    metadata:
      labels:
        app: my-app
    spec:
      containers:
        - name: my-app
          image: your-dockerhub-user/your-app:latest
          ports:
            - containerPort: 8080
Enter fullscreen mode Exit fullscreen mode

🌐 service.yaml (LoadBalancer)

  • Service: Exposes your app so others can access it.
  • type: LoadBalancer: Automatically provisions an AWS Elastic Load Balancer (ELB).
  • port: 80: External port exposed to the world.
  • targetPort: 8080: Port your app is listening on inside the container.
apiVersion: v1
kind: Service
metadata:
  name: my-app-service
spec:
  type: LoadBalancer
  selector:
    app: my-app
  ports:
    - protocol: TCP
      port: 80
      targetPort: 8080
Enter fullscreen mode Exit fullscreen mode

All good, lets apply the config

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

Your app should now be live and rocking the internet, thanks to your shiny new AWS Load Balancer 🙂

Step 4: It's time to access your app
Get the public url for the app

kubectl get svc
Enter fullscreen mode Exit fullscreen mode

The expected output should look like this:

NAME             TYPE           CLUSTER-IP      EXTERNAL-IP       PORT(S)        AGE
my-app-service   LoadBalancer   10.100.22.45    a12b34c5d6e7.elb.amazonaws.com   80:31554/TCP   2m
Enter fullscreen mode Exit fullscreen mode

Copy the EXTERNAL-IP into your browser - boom 🤯 - Your app is now LIVE and ready to rock.

Take away/Bonus Tips for production

You’re running on EKS, now it’s time to level up your game! Here’s how.

Tips

EKS combines the raw power of Kubernetes with AWS’s unbeatable scalability and ecosystem - like giving a rocket booster to your cloud-native apps! 🚀
What began as a playful sandbox experiment has evolved into a battle-tested, production-ready powerhouse. Whether you're tinkering with hobby projects or launching the next big enterprise app, EKS is the launchpad your ideas deserve.

Ready to scale effortlessly? EKS has your back. 💪

Top comments (3)

OSZAR »