Task 2 - Kubernetes projet
Go to file
2025-04-16 09:17:44 +00:00
public Téléverser les fichiers vers "public" 2025-04-15 20:12:35 +00:00
deployment.yaml Add 2025-04-15 20:11:51 +00:00
Dockerfile Add 2025-04-15 20:11:51 +00:00
namespace.yaml Add 2025-04-15 20:11:51 +00:00
package-lock.json Add 2025-04-15 20:11:51 +00:00
package.json Add 2025-04-15 20:11:51 +00:00
prepare-app.sh Add 2025-04-15 20:11:51 +00:00
README.md Actualiser README.md 2025-04-16 09:11:38 +00:00
server.js Add 2025-04-15 20:11:51 +00:00
service.yaml Add 2025-04-15 20:11:51 +00:00
start-app.sh Add 2025-04-15 20:11:51 +00:00
statefulset.yaml Actualiser statefulset.yaml 2025-04-16 09:17:44 +00:00
stop-app.sh Add 2025-04-15 20:11:51 +00:00

Todo App Kubernetes Deployment

This repository contains the Kubernetes configuration files to deploy my Todo App.

Description

The Todo App is a web application for creating, reading, updating, and deleting the task to do. 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: namespace.yaml - The namespace in which all other objects are created.
  • Deployment: deployment.yaml - Defines the deployment configuration for the Todo App.
  • StatefulSet: statefulset.yaml - Defines the stateful set configuration for the Todo App, including PersistentVolume and PersistentVolumeClaim objects.
  • Service: service.yaml - 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:

./prepare-app.sh

Start the Application

Run the following script to create all Kubernetes objects and start the application:

./start-app.sh

Stop the Application

Run the following script to delete all created Kubernetes objects and stop the application:

./stop-app.sh

View the Application

If you are using a LoadBalancer service, you can access the application using the external IP address provided by the service. Run the following command to get the service details:

kubectl get services -n my-namespace

Open a web browser, enter this sentence and replace with the external IP address obtained from the previous step.

http://<external-ip>

This is it, your Todo-List is working, enjoy!