Обновить z2/README.md

This commit is contained in:
Yan Kasabutski 2025-04-17 02:00:49 +00:00
parent 8ed4acfd15
commit 6452cf7e3d

View File

@ -1,4 +1,4 @@
# To-Do List Application on Kubernetes
# Aplikácia To-Do List v Kubernetes
## Application Description
@ -9,76 +9,20 @@ This is a simple To-Do List web application that allows users to:
- Filter tasks by their status (All, Active, Completed)
- Reorder tasks using drag-and-drop functionality
The application uses local storage to persist tasks and allows users to manage their daily tasks efficiently.
## Container Images Used
# Aplikácia To-Do List v Kubernetes
1. **todo-web-app:latest**:
- Custom image based on nginx:alpine
- Contains the static web files (HTML, CSS, JavaScript) for the To-Do List application
- Serves the web interface on port 80
## Popis
2. **redis:alpine**:
- Official Redis image based on Alpine Linux
- Used in the StatefulSet for data persistence
- Stores task data on a persistent volume
- Runs on port 6379
Tento projekt nasadzuje aplikáciu "To-Do List" do Kubernetes. Používa niekoľko komponentov, ako sú deploymenty pre frontend a backend, StatefulSet pre ukladanie dát a služby na interakciu medzi komponentami.
## Kubernetes Objects
## Požiadavky
1. **Namespace** (`todo-app-ns`):
- Isolates all the application resources in a dedicated namespace
- **Kubernetes** (lokálne cez Minikube alebo v cloude)
- **kubectl** na správu klastru
- **Docker** na prácu s kontajnermi
- Lokálny alebo cloudový Docker repozitár (napríklad Docker Hub)
2. **Deployment** (`todo-web-app`):
- Manages the web application containers
- Maintains 2 replicas for high availability
- Defines resource limits and requests
3. **StatefulSet** (`todo-data-manager`):
- Manages Redis instances for data persistence
- Uses persistent storage to maintain task data
- Ensures data consistency during pod restarts
4. **PersistentVolume** (`todo-app-pv`):
- Provides storage resources for the application
- Uses local storage on the host at `/mnt/data/todo-app`
- 1GB capacity for storing task data
5. **PersistentVolumeClaim** (`todo-app-pvc`):
- Claims storage from the PersistentVolume
- Used by the StatefulSet for data persistence
6. **Services**:
- `todo-web-service`: NodePort service exposing the web application
- `todo-data-service`: Headless service for the StatefulSet
## Network and Volume Configuration
### Networks
- The application components communicate within the Kubernetes cluster using services
- `todo-web-service` exposes the web interface externally using NodePort
- `todo-data-service` provides internal DNS-based service discovery for the StatefulSet
### Volumes
- The application uses a persistent volume mounted at `/mnt/data/todo-app` on the host
- This volume is mounted into the Redis container at `/data` to persist task data
- The volume uses the `manual` storage class with ReadWriteOnce access mode
## Container Configuration
### Web Application Container
- Based on nginx:alpine
- Configured to serve static content from `/usr/share/nginx/html`
- Resource limits: 500m CPU, 256Mi memory
- Resource requests: 100m CPU, 128Mi memory
### Redis Container
- Based on redis:alpine
- Data directory mounted to persistent storage
- Resource limits: 300m CPU, 256Mi memory
- Resource requests: 100m CPU, 128Mi memory
## How to Use the Application
### Prerequisites
- Kubernetes cluster (Minikube or similar)
@ -108,13 +52,3 @@ The application uses local storage to persist tasks and allows users to manage t
./stop-app.sh
```
### Accessing the Web Interface
1. After starting the application, note the NodePort displayed in the terminal
2. Open your web browser and navigate to `http://localhost:<NodePort>`
3. You should see the To-Do List application interface
4. Start adding tasks, marking them as completed, or deleting them as needed
## Troubleshooting
- If pods aren't starting, check the pod status: `kubectl get pods -n todo-app-ns`
- For detailed pod issues: `kubectl describe pod <pod-name> -n todo-app-ns`
- To view logs: `kubectl logs <pod-name> -n todo-app-ns`