A comprehensive guide to deploying a React Frontend, Node.js Backend, and MongoDB database on Amazon EKS using Docker, ECR, Helm, Kubernetes, and the AWS Load Balancer Controller.
- Overview
- Architecture Flow
- Prerequisites
- Tool Installation
- Cluster Access Setup
- Deployment Chronology
- MongoDB Deployment
- Backend Deployment
- Frontend Deployment
- Ingress / External Access
- Verification
- Cleanup
This project deploys a three-tier cloud-native application on AWS EKS:
| Tier | Component | Technology | Description |
|---|---|---|---|
| 1οΈβ£ Presentation | React Frontend | Docker, Kubernetes | Provides UI, runs on port 3000 |
| 2οΈβ£ Application | Node.js Backend API | Docker, Kubernetes | Handles business logic on port 3500 |
| 3οΈβ£ Data | MongoDB | Stateful Kubernetes Deployment | Stores application data |
| π External Routing | AWS ALB Ingress Controller | ALB | Publishes services publicly |
Special thanks to LondheShubham153 for helping improve this project!
Use these Kubernetes Cheat Sheet for improving the knowledge on Kubernetes and skills needed for this project!
- Dockerized and pushed to Amazon ECR
- Deployed using Helm in Kubernetes
- Packaged as Docker image β stored in ECR
- Deployed via Helm with environment variables and MongoDB connection string
- Runs as a Kubernetes Deployment + Persistent Volume Claim
- Secured with k8s Secrets
- All components are built and tagged locally
- Images pushed to ECR for deployment
- Stores Docker images consumed by Kubernetes
Handles:
- Rolling updates
- Auto-healing
- Networking
- Scaling
- Pod lifecycle
- AWS ALB Ingress routes external traffic
- Separate routes for frontend (
/) and backend (/api)
- Public ALB endpoint
- Routes traffic to Ingress Controller
- Access the application via ALB FQDN or domain name
Before deploying, ensure you have:
-
An AWS account
-
IAM permissions for:
- EKS
- ECR
- IAM Roles
- ALB Ingress Controller
-
Local copies of:
backend-chart/frontend-chart/
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o awscliv2.zip
unzip awscliv2.zip
sudo ./aws/install
aws --versionaws configurecurl -o kubectl https://s3.us-west-2.amazonaws.com/amazon-eks/1.29/latest/bin/linux/amd64/kubectl
chmod +x kubectl
sudo mv kubectl /usr/local/bin/
kubectl version --clientcurl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash
helm versionaws eks update-kubeconfig --name <CLUSTER_NAME> --region <REGION>
kubectl get nodesBelow is the exact sequence used to deploy your application.
kubectl apply -f mongo_manifests.yaml
kubectl get pods -n three-tierThis includes:
- Secret
- PersistentVolume
- PersistentVolumeClaim
- Service
- Deployment
helm upgrade backend-release ./backend-chart \
--namespace three-tier-app \
--set image.repository="534232118663.dkr.ecr.ap-south-1.amazonaws.com/three-tier-backend-ecr" \
--set image.tag="latest" \
--set mongo.serviceName="mongodb-svc.workshop.svc.cluster.local" \
--set mongo.servicePort=27017kubectl get pods -n three-tier-apphelm upgrade frontend-release ./frontend-chart \
--namespace three-tier-app \
--set image.repository="534232118663.dkr.ecr.ap-south-1.amazonaws.com/three-tier-frontend-ecr" \
--set image.tag="latest" \
--set service.port=3000Converted JSON-style annotations to YAML block style.
helm upgrade frontend-release ./frontend-chart \
--namespace three-tier-app \
--set ingress.enabled=true \
--set ingress.className="alb" \
--set ingress.annotations."alb\.ingress\.kubernetes\.io/scheme"=internet-facing \
--set ingress.annotations."alb\.ingress\.kubernetes\.io/target-type"=ip \
--set ingress.annotations."alb\.ingress\.kubernetes\.io/listen-ports"='[{"HTTP":80}]' \
--set ingress.hosts[0].host="frontend.amanpathakdevops.study" \
--set ingress.hosts[0].paths[0].path="/" \
--set ingress.hosts[0].paths[0].pathType="Prefix" \
--set ingress.hosts[0].paths[1].path="/api" \
--set ingress.hosts[0].paths[1].pathType="Prefix" \
--set ingress.hosts[0].paths[1].backend.service.name="backend-release-backend-chart" \
--set ingress.hosts[0].paths[1].backend.service.port.number=3500kubectl get ingress -n three-tier-appWhen ALB provisioning is complete, add a CNAME record pointing:
frontend.amanpathakdevops.study --> <ALB DNS Name>
Then access your app:
http://frontend.amanpathakdevops.study
eksctl delete cluster --name three-tier-cluster --region us-west-2