AWS makes it much easier to deploy containerized applications, and running Kubernetes in the cloud is a powerful way to scale and manage these applications.
Among the many managed Kubernetes services AWS offers, Amazon EKS (Elastic Kubernetes Service) stands out for its seamless integration with the AWS ecosystem, strong reliability, and excellent support.
If you’re ready to move beyond local setups and want to deploy a real-world Kubernetes app on AWS EKS, this guide will walk you through the entire process. Whether you’re working on a microservice, a full-stack app, or just experimenting with Kubernetes in an environment that mimics production, you’ll find this walkthrough useful.
In this article, I’ll guide you through the process of creating your EKS cluster, deploying your application, and making it accessible over the internet, step by step.
What We’ll Cover:
Prerequisites
To get started, make sure you have the following installed on your local machine:
Have a basic understanding of cloud services.
Have a basic understanding of the Linux command line.
Have an AWS account.
Install eksctl, a simple CLI tool to create and manage EKS clusters.
Install kubectl, the standard Kubernetes command-line tool.
Install Docker to build and package your app into a container.
Before setting up a Kubernetes cluster for our application, it’s essential to understand a few basic concepts.
What is a Kubernetes Cluster?
A Kubernetes (also called K8S) cluster consists of machines (called nodes) that run containerized applications. It works alongside container engines like CRI-O or containerd to help you deploy and manage your apps more efficiently.
Kubernetes nodes come in two main types:
Master nodes (control plane): These handle the brainwork, such as scheduling, scaling, and managing the cluster’s overall state.
Worker nodes (data plane): They run the actual applications inside the containers.
If you’re new to Kubernetes or want to brush up, check out the free course Introduction to Kubernetes (LFS158) from the Linux Foundation.
What is Amazon Elastic Kubernetes Service?
Amazon Elastic Kubernetes Service (EKS) is a managed service that enables easy Kubernetes deployment on AWS, eliminating the need to set up and maintain your own Kubernetes control plane node.
AWS EKS takes care of the heavy lifting by managing the control plane, handling upgrades, and installing core components, such as the container runtime and essential Kubernetes processes. It also offers built-in tools for scaling, high availability, and backup.
With EKS, you or your team can focus on building and running applications, while AWS handles the underlying infrastructure.
Why Use Amazon EKS for Kubernetes?
Here are some key benefits of using AWS EKS:
EKS handles upgrades, patching, and high availability for you, giving you a fully managed control plane with minimal manual effort.
You can easily scale your applications, and the infrastructure grows as your needs evolve.
It has built-in support for IAM roles, private networking, and encryption.
AWS EKS runs on highly available infrastructure across multiple AWS Availability Zones, making your application available globally.
With Amazon EKS, you get the power of Kubernetes without managing the underlying setup. So you can stay focused on building and running your apps.
How to Create a Kubernetes Cluster Using AWS
Now let’s walk through the process of getting a Kubernetes cluster up and running.
Step 1: How to Install the Tools Needed to Create a Cluster
The easiest and most developer-friendly way to spin up an Elastic Kubernetes Service that you can use at the production level is by using eksctl. It takes care of the manual setup and automatically provisions the necessary AWS resources.
Before we begin, we need to install two essential tools:
eksctl – This is used to create and manage your EKS cluster.
kubectl – This allows you to interact with your cluster, deploy apps, and manage Kubernetes resources.
These tools will make it easy to set up your Kubernetes cluster and work with it directly from your terminal.
How to Install eksctl
Open your browser and go to the official eksctl documentation. Scroll down to the Installation section.
Scroll to the Unix instructions if you’re using Ubuntu or a similar system. Then copy the installation command and paste it into your terminal.
Once it’s done, run eksctl version
to confirm that the installation was successful.
How to Install kubectl
The next step is to install kubectl. You can find the installation instructions in the official Kubernetes documentation, which provides steps based on your operating system.
Step 2: How to Create the Elastic Kubernetes Service (EKS) Cluster
Now that you’ve installed the tools needed to create and interact with a Kubernetes cluster on AWS, it’s time to launch the cluster.
To get started, open your terminal and run the following command:
# Create an EKS cluster named "k8s-example" in eu-west-2 (London)
eksctl create cluster --name k8s-example --region eu-west-2
One great thing about using AWS EKS is that once your Kubernetes cluster is created, it automatically updates your ~/.kube/config
file. This means you can start interacting with your cluster right away, using kubectl
– no extra setup needed.
After running the command (as shown in the GIF above), your Kubernetes cluster is successfully created.
Head over to the AWS console, and you’ll see your new cluster listed with a status of Active.
With your cluster up and running, it’s time to test the connection. You can do this by running a few kubectl
commands in your terminal to list the nodes, pods and namespaces in your cluster.
To test the connection:
kubectl get nodes
This command lists all the nodes in your cluster.
kubectl get pods
This command lists all the pods currently running.
kubectl get namespaces
This command lists all the namespaces currently running.
If each command returns a list of resources, congratulations! Your connection to the Kubernetes cluster is successful.
Step 3: How to Create Kubernetes Manifests
Let’s define the application using a YAML file. In this file, you’ll create two key resources: a Deployment and a Service.
The Deployment ensures your application runs reliably by specifying how many replicas to run, which container image to use, and how to manage updates.
The Service makes your application accessible — both within the Kubernetes cluster and, if needed, from the internet, even if the underlying pods change or restart.
Together, these resources orchestrate your application so it can run consistently in different environments and be accessed by others.
#deployment-example.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: amazon-deployment
namespace: default
labels:
app: amazon-app
spec:
replicas: 5
selector:
matchLabels:
app: amazon-app
tier: frontend
version: 1.0.0
template:
metadata:
labels:
app: amazon-app
tier: frontend
version: 1.0.0
spec:
containers:
- name: amazon-container
image: ooghenekaro/amazon:2
ports:
- containerPort: 3000
---
apiVersion: v1
kind: Service
metadata:
name: amazon-service
labels:
app: amazon-app
spec:
type: LoadBalancer
ports:
- port: 80
targetPort: 3000
selector:
app: amazon-app
The service uses a LoadBalancer type, which tells AWS to provision an Elastic Load Balancer (ELB) and route traffic to the pods.
Step 4: How to Deploy the App to EKS
Now that your YAML file is defined and the Kubernetes cluster on AWS EKS is ready, it’s time to deploy your application.
To do this, run the following command in your terminal to apply the configuration defined in your manifest file:
kubectl apply -f deployment-example.yaml
This command tells Kubernetes to create the necessary pods and services based on what’s specified in the manifest file.
Next, you can check the status of your pods and services:
kubectl get pods
kubectl get svc or service
kubectl get all
Step 5: How to Access Your Application
To view your application in the browser, run the following command to list your services:
kubectl get svc
Look for the EXTERNAL-IP of your service.
Copy the IP address and paste it into your browser. Your app should now be live!
Conclusion
Deploying a Kubernetes app on AWS EKS may seem complex at first, but with tools like eksctl and kubectl, the process is surprisingly approachable.
Whether you’re a developer experimenting with Kubernetes or a team looking to scale production workloads, EKS provides a strong, scalable foundation that supports your applications as they grow.
Resources
Thanks for reading!
Source: freeCodeCamp Programming Tutorials: Python, JavaScript, Git & MoreÂ