27 lines
983 B
Markdown
27 lines
983 B
Markdown
# Flask + PostgreSQL Kubernetes Deployment
|
|
|
|
This project deploys a Flask web application with a PostgreSQL backend using Kubernetes.
|
|
|
|
## 🛠 Structure
|
|
|
|
- `app/`: Flask source code (`main.py`, `requirements.txt`)
|
|
- `k8s/`: Kubernetes manifests for deployments, services, namespace, etc.
|
|
- `Dockerfile`: Builds the Flask app image
|
|
- `prepare-app.sh`: Builds Docker image and prepares volumes
|
|
- `start-app.sh`: Applies all Kubernetes objects
|
|
- `stop-app.sh`: Deletes all Kubernetes resources
|
|
- `statefulset.yaml`: Defines StatefulSet, PV, and PVC
|
|
|
|
## 🚀 Steps to Deploy
|
|
|
|
1. **Prepare the application:**
|
|
```bash
|
|
./prepare-app.sh
|
|
|
|
|
|
hafzal03@LAPTOP-ELUS3HGM:~/mypro/z2$ kubectl get pods -n webapp-namespace
|
|
NAME READY STATUS RESTARTS AGE
|
|
flask-app-6b844bf6-cq9t6 1/1 Running 0 8m37s
|
|
postgres-644fc4c86d-l9h4f 1/1 Running 0 14m
|
|
hafzal03@LAPTOP-ELUS3HGM:~/mypro/z2$ minikube service flask-service -n webapp-namespace
|