Stop managing EC2 nodes! In this hands-on tutorial, we build a 100% Serverless Kubernetes cluster on AWS using Elastic Kubernetes Service (EKS) and AWS Fargate.
We ditch the servers and use eksctl to provision the entire network and control plane with just ONE command. You'll learn how Fargate Profiles work to intercept workloads, deploy a sample NGINX application, and verify that your pods are running on managed infrastructure without a single EC2 instance in sight.
Save this video for when you need to spin up a quick, clean Kubernetes test environment.
💻 THE COMMANDS USED IN THIS VIDEO:
Step 1: Create the Fargate-only Cluster (Note: This process takes 15-20 minutes to provision the control plane)
Bash
eksctl create cluster \
--name fargate-lab \
--region us-east-1 \
--fargate
Step 2: Create a Custom Fargate Profile We target a specific namespace so pods land on Fargate.
Bash
eksctl create fargateprofile \
--cluster fargate-lab \
--region us-east-1 \
--name my-app-profile \
--namespace serverless-app
Step 3: Deploy the Sample NGINX App First, create the namespace to match the profile:
Bash
kubectl create namespace serverless-app
Next, create a file named nginx-fargate.yaml and paste in the following content:
YAML
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
namespace: serverless-app
spec:
selector:
matchLabels:
app: nginx
replicas: 2
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:latest
ports:
- containerPort: 80
resources:
requests:
cpu: "256m"
memory: "512Mi"
Apply the file:
Bash
kubectl apply -f nginx-fargate.yaml
Step 4: Verify and Access Check that the nodes are Fargate compute (look for "fargate-ip" in the NODE column):
Bash
kubectl get pods -n serverless-app -o wide
Access the NGINX home page locally via port-forwarding:
Bash
kubectl port-forward deployment/nginx-deployment -n serverless-app 8080:80
# Open
http://localhost:8080 in your browser
Step 5: The Teardown (IMPORTANT) Delete the lab to avoid incurring costs for the control plane and Fargate usage.
Bash
eksctl delete cluster --name fargate-lab --region us-east-1
🔗 PREREQUISITE LINKS: You must have these three tools installed and configured before starting.
AWS CLI Install Guide:
https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.htmlkubectl Install Guide:
https://kubernetes.io/docs/tasks/tools/eksctl Installation:
https://eksctl.io/installation/Does your organization prefer EC2 worker nodes or Fargate serverless for production workloads? Let me know in the comments below!
#AWS #Kubernetes #EKS #Fargate #Serverless #DevOps #eksctl