zkt23/z2/README.md

45 lines
2.2 KiB
Markdown
Raw Normal View History

2023-05-07 19:32:58 +00:00
# My Web Application
## Project Description
This project is a simple web application that provides a user interface to manage a MySQL database. The application consists of a single page that allows the user to perform basic CRUD operations on a list of items stored in the database.
Containers
## The application consists of the following containers:
mysql: This container runs the MySQL database server.
web: This container runs the web server and serves the web pages to the user.
## The following Kubernetes objects are used in the application:
PersistentVolume: This object is used to create a named volume for the MySQL data.
StatefulSet: This object is used to manage the mysql container and ensure that there is only one instance running at any given time.
Deployment: This object is used to manage the web container and ensure that there is always at least one instance running.
Service: This object is used to provide access to the mysql and web containers from outside the Kubernetes cluster.
## Virtual Networks and Named Volumes
The application uses a virtual network to allow communication between the mysql and web containers. The mysql container stores its data in a named volume called mysql-persistent-storage.
## Container Configuration
The mysql container is configured to use the mysql-persistent-storage volume for data storage. The web container is configured to connect to the mysql container using the Kubernetes service mysql.
## To run the application, perform the following steps:
Install Kubernetes on your machine.
Clone the project repository.
Change into the project directory.
Execute "./start-app.sh" make sure it have execution permission.
Wait for the mysql and web containers to start: kubectl get pods -n my-app.
## To view the application on the web, perform the following steps:
Get the IP address of the web service "kubectl get services -n my-app" or use loclahost.
In your web browser, navigate to http://<web-service-ip>.
## To clean up the application, perform the following steps:
Execute "./stop-app.sh" make sure it have execution permission.