sk1/z2
2025-04-16 11:00:14 +02:00
..
app Initial commit - Flask + PostgreSQL Kubernetes app 2025-04-16 09:54:14 +02:00
k8s Initial commit - Flask + PostgreSQL Kubernetes app 2025-04-16 09:54:14 +02:00
Dockerfile Initial commit - Flask + PostgreSQL Kubernetes app 2025-04-16 09:54:14 +02:00
prepare-app.sh Initial commit - Flask + PostgreSQL Kubernetes app 2025-04-16 09:54:14 +02:00
README.md hafzal 2025-04-16 11:00:14 +02:00
start-app.sh Initial commit - Flask + PostgreSQL Kubernetes app 2025-04-16 09:54:14 +02:00
stop-app.sh Initial commit - Flask + PostgreSQL Kubernetes app 2025-04-16 09:54:14 +02:00

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:
    ./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

minikube service flask-service -n webapp-namespace

kubectl get pods -n webapp-namespace

kubectl rollout restart deployment flask-app -n webapp-namespace