Update z2/README.md
"ssk"
This commit is contained in:
parent
cdb9742ec8
commit
858207e89a
69
z2/README.md
69
z2/README.md
@ -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
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user