Go to file
2026-05-12 20:37:46 +00:00
sk1 Update sk1/README.md 2026-05-12 20:37:46 +00:00
z1 Second Assignment 2026-04-29 00:17:12 +02:00
z2 Second Assignment 2026-04-29 00:29:19 +02:00
.gitignore Second Assignment 2026-04-29 00:17:12 +02:00
README.md Update README.md 2026-04-27 22:34:15 +00:00

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:
    • frontend
    • backend
  • 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.html is 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.