Deploying a 3-Tier Wanderlust MERN Stack Application on Kubernetes
As a DevOps Engineer, I recently had the privilege of working on an innovative project that combined the power of AWS EC2, Kubernetes KubeADM, and the MERN stack. Here’s a deeper dive into what we accomplished:
Project Overview
Application Components
Frontend in ReactJS 🌐 : Deployed a dynamic and responsive ReactJS application, ensuring a seamless and engaging user experience. Optimized the build and deployment processes to achieve rapid, zero-downtime updates.
Backend in NodeJS 🔙: Engineered a scalable and efficient NodeJS backend to handle API requests and business logic. Focused on performance optimization and robust API integrations to support high traffic.
Database in MongoDB 💾: Implemented MongoDB for efficient data storage and retrieval. Designed the database architecture to handle large datasets and provide quick access to critical information.
Detailed Deployment Steps
Setting Up the Kubernetes Cluster
First, set up two Virtual servers for Kubernetes architecture
Then Install Docker and KubeADM
Clone code from remote repository (GitHub) :
Change Environment variables:
Change .env.sample connection at frontend
Change .env.sample connection at backend
Docker Build
Push Docker Images to Docker Hub
K8S Deployment Files
Persistent Volume
Create persistentVolume.yml:
Persistent Volume Claim
Create persistentVolumeClaim.yml:
MongoDB Deployment
Create mongodb.yml:
Backend Deployment
Create backend-deployment.yml:
Frontend Deployment
Create frontend-deployment.yml:
Enable DNS Resolution on Kubernetes Cluster
Check coredns pod in kube-system namespace
Scale coredns pod on worker node as well for DNS resolution
Edit replica from 2 to 4
Deploy Manifest Files to Kubernetes Cluster
Get All Objects Inside wanderlust namespace
Add Data to MongoDB Wanderlust
Connect to Mongo Pod
Execute mongoimport Command
Results:
Website:
Conclusion
Working on the "Wanderlust" project has been a transformative experience, showcasing the synergy of AWS EC2, Kubernetes KubeADM, and the MERN stack. Deploying a dynamic ReactJS frontend, a robust NodeJS backend, and an efficient MongoDB database demonstrated the power of a well-orchestrated 3-tier architecture.
This project not only enhanced my technical prowess but also underscored the importance of collaboration and continuous learning. By conducting training sessions and promoting DevOps best practices, we fostered a culture of innovation and teamwork, paving the way for future success in deploying scalable and efficient applications.
🤝Many thanks to Shubham Londhe and his DevOps Bootcamp.
#DevOps #MERNStack #ReactJS #NodeJS #MongoDB #Kubernetes #AWS #EC2 #KubeAdm #CI/CD