From 2d757a2bf1d483fc6baa968802d18873e1e84840 Mon Sep 17 00:00:00 2001 From: Somangsu Mukherjee Date: Mon, 20 Apr 2026 21:33:44 +0000 Subject: [PATCH] Update z2/README.md --- z2/README.md | 470 +++++++++++++++++++++++++-------------------------- 1 file changed, 235 insertions(+), 235 deletions(-) diff --git a/z2/README.md b/z2/README.md index 9145aef..a6e4870 100644 --- a/z2/README.md +++ b/z2/README.md @@ -1,236 +1,236 @@ -1. Application Description -This project is a simple full-stack web application deployed on Kubernetes. -It allows users to submit names through a web interface and store them in a PostgreSQL database. -The system consists of: - - -A frontend (static HTML interface) - - -A backend API built with Node.js (Express) - - -A PostgreSQL database running as a StatefulSet with persistent storage - - -The backend provides REST endpoints: - - -POST /add → adds a name to the database - - -GET /names → retrieves all stored names - - - -2. Containers Used -Backend (Node.js) - - -Image: docker-app-backend:latest - - -Purpose: Handles API requests and communicates with the database - - -Database (PostgreSQL) - - -Image: postgres:15 - - -Purpose: Stores application data persistently - - - -3. Kubernetes Objects -Namespace - - -Name: myapp - - -Used to isolate all application resources - - -Deployment - - -Name: backend - - -Runs the Node.js backend - - -Ensures availability and automatic restart of the backend container - - -StatefulSet - - -Name: db - - -Runs PostgreSQL - - -Provides stable identity and persistent storage - - -PersistentVolume (PV) - - -Stores PostgreSQL data on node storage - - -PersistentVolumeClaim (PVC) - - -Automatically created via StatefulSet - - -Requests storage for database persistence - - -Services -backend-service (NodePort) - - -Exposes backend externally - - -Accessible at: -http://localhost:30007 - - -db service (ClusterIP) - - -Enables internal communication between backend and database - - -Backend connects using hostname: db - - - -4. Networking - - -Kubernetes DNS allows communication between differents components of the application using service names. Backend communicates with database using db and external users access backend via NodePort service - - - -5. Persistent Storage -PostgreSQL uses: -PersistentVolume (PV) and PersistentVolumeClaim (PVC) - -Using these ensures that data is not lost after pod restart and application state is preserved - - -6. Container Configuration -Backend - - -Port: 3000 - - -Database connection: - - -Host: db - - -User: user - - -Password: password - - -Database: mydb - - - - -Database - - -Port: 5432 - - -This uses persistent volume for data storage - - -7. Preparation -Build backend image: -docker build -t docker-app-backend ./backend - -8. Deployment -Apply all Kubernetes resources: -kubectl apply -f namespace.yamlkubectl apply -f deployment.yamlkubectl apply -f service.yamlkubectl apply -f statefulset.yamlkubectl apply -f db-service.yaml - -9. Checking Application Status -kubectl get all -n myappkubectl get pods -n myappkubectl get svc -n myapp - -10. Accessing the Application -Backend API: -http://localhost:30007 -Frontend: -Open frontend/index.html in a browser - -11. Stopping the Application -kubectl delete -f deployment.yamlkubectl delete -f service.yamlkubectl delete -f statefulset.yamlkubectl delete -f db-service.yamlkubectl delete namespace myapp - -12. Removing All Resources -kubectl delete namespace myapp - -13. Used Resources - - -Kubernetes Documentation: https://kubernetes.io/docs/ - - -Docker Documentation: https://docs.docker.com/ - - -PostgreSQL Docker Image - - -Node.js Express Framework - - - -14. Use of Artificial Intelligence -Artificial intelligence tools were used to: - - -Assist with debugging deployment issues - - -Improve configuration of Kubernetes objects - - -Help structure the project and documentation - - -All implementation, testing, and understanding were performed independently. - -15. Summary -This project demonstrates: - - -Containerized web application architecture - - -Kubernetes Deployment and StatefulSet usage - - -Persistent storage with PVC - - -Internal service communication using DNS - - -External access using NodePort - - +*1. Application Description* + +This project is a simple full-stack web application deployed on Kubernetes. +It allows users to submit names through a web interface and store them in a PostgreSQL database. +The system consists of: + + +A frontend (static HTML interface) + +A backend API built with Node.js (Express) + + +A PostgreSQL database running as a StatefulSet with persistent storage + + +The backend provides REST endpoints: + + +POST /add → adds a name to the database + + +GET /names → retrieves all stored names + + + +2. Containers Used +Backend (Node.js) + + +Image: docker-app-backend:latest + + +Purpose: Handles API requests and communicates with the database + + +Database (PostgreSQL) + + +Image: postgres:15 + + +Purpose: Stores application data persistently + + + +3. Kubernetes Objects +Namespace + + +Name: myapp + + +Used to isolate all application resources + + +Deployment + + +Name: backend + + +Runs the Node.js backend + + +Ensures availability and automatic restart of the backend container + + +StatefulSet + + +Name: db + + +Runs PostgreSQL + + +Provides stable identity and persistent storage + + +PersistentVolume (PV) + + +Stores PostgreSQL data on node storage + + +PersistentVolumeClaim (PVC) + + +Automatically created via StatefulSet + + +Requests storage for database persistence + + +Services +backend-service (NodePort) + + +Exposes backend externally + + +Accessible at: +http://localhost:30007 + + +db service (ClusterIP) + + +Enables internal communication between backend and database + + +Backend connects using hostname: db + + + +4. Networking + + +Kubernetes DNS allows communication between differents components of the application using service names. Backend communicates with database using db and external users access backend via NodePort service + + + +5. Persistent Storage +PostgreSQL uses: +PersistentVolume (PV) and PersistentVolumeClaim (PVC) + +Using these ensures that data is not lost after pod restart and application state is preserved + + +6. Container Configuration +Backend + + +Port: 3000 + + +Database connection: + + +Host: db + + +User: user + + +Password: password + + +Database: mydb + + + + +Database + + +Port: 5432 + + +This uses persistent volume for data storage + + +7. Preparation +Build backend image: +docker build -t docker-app-backend ./backend + +8. Deployment +Apply all Kubernetes resources: +kubectl apply -f namespace.yamlkubectl apply -f deployment.yamlkubectl apply -f service.yamlkubectl apply -f statefulset.yamlkubectl apply -f db-service.yaml + +9. Checking Application Status +kubectl get all -n myappkubectl get pods -n myappkubectl get svc -n myapp + +10. Accessing the Application +Backend API: +http://localhost:30007 +Frontend: +Open frontend/index.html in a browser + +11. Stopping the Application +kubectl delete -f deployment.yamlkubectl delete -f service.yamlkubectl delete -f statefulset.yamlkubectl delete -f db-service.yamlkubectl delete namespace myapp + +12. Removing All Resources +kubectl delete namespace myapp + +13. Used Resources + + +Kubernetes Documentation: https://kubernetes.io/docs/ + + +Docker Documentation: https://docs.docker.com/ + + +PostgreSQL Docker Image + + +Node.js Express Framework + + + +14. Use of Artificial Intelligence +Artificial intelligence tools were used to: + + +Assist with debugging deployment issues + + +Improve configuration of Kubernetes objects + + +Help structure the project and documentation + + +All implementation, testing, and understanding were performed independently. + +15. Summary +This project demonstrates: + + +Containerized web application architecture + + +Kubernetes Deployment and StatefulSet usage + + +Persistent storage with PVC + + +Internal service communication using DNS + + +External access using NodePort + + The application is fully functional and can store and retrieve data using a Kubernetes-based backend and database. AI was use strictly for learninf concepts and debugging, all coding and implementation was done independently. \ No newline at end of file