zkt25/z2/myproject/scripts/start-app.sh
2025-04-15 21:57:57 +02:00

26 lines
676 B
Bash
Executable File

#!/bin/bash
# Create namespace
kubectl apply -f k8s/namespace.yaml
# Create PV and PVC
kubectl apply -f k8s/pv-pvc.yaml
# Create StatefulSet
kubectl apply -f k8s/statefulset.yaml
# Create Deployment
kubectl apply -f k8s/deployment.yaml
# Create Service
kubectl apply -f k8s/service.yaml
# Wait for pods to be ready
kubectl wait --for=condition=Ready pod -l app=django --namespace django-namespace --timeout=120s
# Perform migrations
kubectl exec -it $(kubectl get pods -n django-namespace -l app=django -o jsonpath='{.items[0].metadata.name}') -n django-namespace -- python manage.py migrate
# Get service URL
minikube service django-service --url -n django-namespace