z2/README.md

96 lines
2.8 KiB
Markdown

# Todo App Kubernetes Deployment
This repository contains the Kubernetes configuration files to deploy the Todo App. Follow the instructions below to deploy the application on your Kubernetes cluster.
## Description
The Todo App is a simple web application that allows users to create, read, update, and delete todo items. It is built using Node.js and is containerized using Docker.
## Containers Used
- **elineen/todo-app:latest**: The main application container that runs the Todo App.
## Kubernetes Objects
- **Namespace**: `my-namespace` - The namespace in which all other objects are created.
- **Deployment**: Defines the deployment configuration for the Todo App.
- **StatefulSet**: Defines the stateful set configuration for the Todo App, including PersistentVolume and PersistentVolumeClaim objects.
- **Service**: Exposes the Todo App to the network.
## Virtual Networks and Named Volumes
- **PersistentVolume**: Defines a persistent volume for storing application data.
- **PersistentVolumeClaim**: Claims the persistent volume for use by the StatefulSet.
## Container Configuration
The container configuration includes the following:
- **Image**: `elineen/todo-app:latest`
- **Ports**: The application listens on port 8080.
- **Volume Mounts**: The container mounts the persistent volume at `/data`.
## Instructions
### Prerequisites
- Kubernetes cluster (e.g., Minikube, Docker Desktop, or a cloud provider like GKE, EKS, AKS)
- `kubectl` command-line tool installed and configured to interact with your Kubernetes cluster
- Docker installed and configured to pull images from Docker Hub
### Prepare the Application
Run the following script to prepare the application, build the Docker image, and create the persistent volumes:
```bash
./prepare-app.sh
```
# Web Application Deployment to Kubernetes
## Description
This project deploys a web application to Kubernetes.
## Containers Used
- **web-app-container**: A container running a Node.js application.
## Kubernetes Objects
- **Namespace**: `my-namespace`
- **Deployment**: `web-app-deployment`
- **StatefulSet**: `web-app-statefulset`
- **Service**: `web-app-service`
- **PersistentVolume**: `pv-volume`
- **PersistentVolumeClaim**: `pvc-claim`
## Virtual Networks and Named Volumes
- The application uses a PersistentVolume and PersistentVolumeClaim to store data.
- The Service exposes the application on port 80.
## Container Configuration
- The Dockerfile builds a Node.js application and exposes port 8080.
- The Deployment and StatefulSet use the image `my-web-app:latest`.
## Instructions
### Prepare the Application
1. Run the `prepare-app.sh` script to build the Docker image and create the namespace and persistent volumes.
```bash
./prepare-app.sh```
###2. Create the Namespace
```bash
kubectl apply -f namespace.yaml```