| sk1@ab722d7325 | ||
| z1 | ||
| z2 | ||
| .gitignore | ||
| README.md | ||
Notes Application - Docker & Kubernetes Deployment
Overview
This project is a Notes Application deployed using Docker and Kubernetes (MicroK8s). The application allows users to:
- Create notes
- Delete notes
- Upload files
- Download files
It follows a 3-tier architecture:
- Frontend (Nginx)
- Backend (Node.js)
- Database (MongoDB)
Architecture
User -> Frontend (Nginx) -> Backend (Node.js) -> MongoDB
Containers
Frontend
- Image:
nginx:alpine - Role: Serves static UI
- Port:
80
Backend
- Image:
node:18 - Role: API server (handles notes & files)
- Port:
3000
Database
- Image:
mongo:6.0 - Role: Stores notes and file data
- Port:
27017
Kubernetes Resources
- Namespace:
z2 - Deployments:
frontendbackend
- StatefulSet:
mongo
- Services:
frontend(NodePort -> 30007)backend(ClusterIP)mongo(Headless Service)
Storage
- Persistent Volume Claim:
mongo-storage - Size:
1Gi - Mount path:
/data/db - Purpose: Store MongoDB data persistently
Setup Instructions
1. Prepare Application
./prepare-app.sh
- Builds Docker images
- Loads them into MicroK8s
2. Start Application
./start-app.sh
- Deploys Kubernetes resources
- Starts all services
3. Stop Application
./stop-app.sh
- Stops running pods
- Keeps configuration
4. Delete Application
microk8s kubectl delete all --all -n z2
microk8s kubectl delete pvc --all -n z2
- Removes everything including database
Access Application
Open in browser:
http://<server-ip>:30007
Example:
http://147.232.204.210:30007
Useful Commands
Check pods:
microk8s kubectl get pods -n z2
Check services:
microk8s kubectl get svc -n z2
View logs:
microk8s kubectl logs <pod-name> -n z2
Common Issues
Mongo Crash (version error)
Fix:
microk8s kubectl delete pvc --all -n z2
Frontend shows "Welcome to nginx"
Fix:
- Ensure
index.htmlis copied in Dockerfile - Rebuild using:
./prepare-app.sh
Honesty Statement
This project was developed with the assistance of AI tools (such as ChatGPT) for:
- Debugging errors
- Understanding Kubernetes concepts
- Identifying fixes for deployment issues
All configurations, testing, and final implementation were completed independently, and the AI was used strictly as a learning aid.