This project demonstrates the deployment of a MERN (MongoDB, Express, React, Node.js) microservices-based application using:
- Containerization with Docker
- Orchestration using Kubernetes
- Deployment tested on local Kubernetes (GKE-compatible)
The application consists of:
- Frontend (React)
- Backend microservices:
- hello-service
- profile-service
- MongoDB database
graph TD
User --> Frontend
Frontend --> HelloService
Frontend --> ProfileService
ProfileService --> MongoDB
subgraph Kubernetes Cluster
Frontend
HelloService
ProfileService
MongoDB
end
- Docker
- Kubernetes
- Node.js
- React.js
- MongoDB
- kubectl
- Git & GitHub
SampleMERNwithMicroservices/
├── frontend/
├── backend/
│ ├── helloService/
│ └── profileService/
├── k8s/
│ ├── frontend.yaml
│ ├── hello-service.yaml
│ ├── profile-service.yaml
│ └── mongodb.yaml
├── README.md
└── .gitignore
git clone https://github.com/<your-username>/mern-k8s-deployment.git
cd mern-k8s-deployment
docker build -t gcr.io/<project-id>/frontend ./frontend
docker build -t gcr.io/<project-id>/hello-service ./backend/helloService
docker build -t gcr.io/<project-id>/profile-service ./backend/profileService
docker push gcr.io/<project-id>/frontend
docker push gcr.io/<project-id>/hello-service
docker push gcr.io/<project-id>/profile-service
kubectl apply -f k8s/
kubectl get pods
kubectl get svc
kubectl port-forward service/frontend-service 8080:80
kubectl port-forward service/hello-service 3001:3001
kubectl port-forward service/profile-service 3002:3002
Open:
http://localhost:8080
http://localhost:30007
GET /health
http://localhost:3001/health
GET /health
http://localhost:3002/health
- Missing Dockerfiles in initial project
- Multi-service backend required separate containerization
- Kubernetes CrashLoopBackOff debugging
- Environment variable mismatch (
MONGO_URL) - MongoDB connection configuration
- NodePort vs ClusterIP access issues
- Created Dockerfiles for each microservice
- Used Kubernetes Deployments & Services
- Injected environment variables via YAML
- Deployed MongoDB inside cluster
- Used port-forward for local access
- Fixed service communication issues
- Microservices architecture in Kubernetes
- Docker image lifecycle
- Kubernetes networking (ClusterIP vs NodePort)
- Debugging real-world deployment issues
- Environment variable management in containers
DEEPIKA NARENDRAN *DevOps Technical Lead | *
This project successfully demonstrates deploying a scalable MERN microservices application using Kubernetes. It highlights real-world DevOps practices including containerization, orchestration, service communication, and troubleshooting.