# KUBERNETES APP DOCUMENTATION ## AUTHOR : Somangsu Mukherjee --- **1. Conditions for Deployment** The application requires the following software: - Docker (version 20 or newer) - Kubernetes (Docker Desktop Kubernetes or Minikube) - kubectl (configured and working) - Bash shell (WSL recommended on Windows) - Internet connection (to download container images) --- **2. Application Description** This is a Kubernetes-based multi-container web application. The application allows users to: - Enter their name in a web interface - Submit the name to a backend server - Store the name in a PostgreSQL database - Retrieve and display all stored names The application demonstrates communication and orchestration of multiple services using Kubernetes. --- **3. Virtual Networks and Volumes** **Virtual Network** Kubernetes automatically manages networking between services and pods using internal DNS. Services communicate using service names: - Backend communicates with database (`db`) - External users access backend through NodePort service **Named Volume** Persistent storage is implemented using: - PersistentVolume (PV) - PersistentVolumeClaim (PVC) These are mounted to `/var/lib/postgresql/data` inside the PostgreSQL container This ensures that data is preserved even if pods are restarted or recreated --- **4. Container Configuration** **Backend** - Image: `docker-app-backend:latest` - Port: `3000` - Built using Node.js and Express framework - Communicates with PostgreSQL database to store and retrieve names - Deployed using Kubernetes Deployment **Database (PostgreSQL)** - Image: `postgres:15` - Port: `5432` - Environment variables: - `POSTGRES_USER=user` - `POSTGRES_PASSWORD=password` - `POSTGRES_DB=mydb` The database uses PersistentVolume and PersistentVolumeClaim for persistence which ensures that data is not lost even after pod restarts Uses StatefulSet for stable identity and storage --- **5. The table below describes all the components utilised in this assignment** | Component | Description | |--------------|--------------------------------------------------| | Namespace | Isolates all application resources | | Deployment | Runs Node.js backend application | | StatefulSet | Runs PostgreSQL database with persistent storage | | Service | Exposes backend externally using NodePort | | DB Service | Enables internal communication with database | --- **6. Application Control** **Prepare Application:** To prepare the application, the backend image must be built using: docker build -t docker-app-backend ./backend **Start Application:** Run the following command in WSL: ./start-app.sh This creates all Kubernetes resources and starts the application Stop Application To stop the application: ./stop-app.sh **Remove Application** Deleting the namespace removes all resources completely: kubectl delete namespace myapp --- **7. Accessing the Application** Backend API can be accessed at: http://localhost:30007 Frontend can be accessed by opening: frontend/index.html --- **8. Used Resources** Kubernetes official documentation Docker documentation Node.js documentation PostgreSQL documentation --- **9. Use of Artificial Intelligence** Artificial intelligence tools were used as a support tool during development for understanding Kubernetes concepts and debugging deployment issues. Some configuration problems were resolved with AI assistance. All implementation, testing, and integration were performed independently.