Update z2/README.md

"ssk"
This commit is contained in:
Santhosh Karuppasamy 2025-04-16 08:57:54 +00:00
parent cdb9742ec8
commit 858207e89a

View File

@ -0,0 +1,69 @@
# Django with PostgreSQL on Kubernetes
This project demonstrates how to deploy a Django application with PostgreSQL database on Kubernetes.
## Project Structure
├── Dockerfile # Docker configuration for Django app
├── docker-compose.yml # Docker Compose configuration (if applicable)
├── k8s/ # Kubernetes configuration files
│ ├── namespace.yaml # Namespace configuration
│ ├── statefulset.yaml # PostgreSQL StatefulSet with PV/PVC
│ ├── deployment.yaml # Django application deployment
│ ├── service.yaml # Django service (NodePort)
│ ├── migrate-job.yaml # Job for Django migrations
├── manage.py # Django management script
├── myapp/ # Django app directory
├── myproject/ # Django project directory
├── requirements.txt # Python dependencies
├── scripts/ # Utility scripts
├── wait-for-it.sh # DB connection checker
└── *.sh # Various utility scripts
Utility Scripts
prepare-app.sh: Prepares the application for deployment
start-app.sh: Starts the application
stop-app.sh: Stops the application
remove-app.sh: Removes the application
stat.sh: Shows application status
wait-for-it.sh: Waits for database to be ready
## Prerequisites
- Kubernetes cluster (Minikube or cloud provider)
- kubectl configured to access your cluster
- Docker installed (for building images)
## Deployment Steps
1. **Build the Django Docker image**:
```bash
docker build -t django-app:latest .
#Troubleshooting
kubectl get pods -n webapp-namespace
kubectl logs <pod-name> -n webapp-namespace
kubectl get svc -n webapp-namespace
kubectl get pv,pvc -n webapp-namespace
#clean
kubectl delete namespace webapp-namespace
minikube service django-service --url -n webapp-namespace