Example Django application running on Postgres with Kubernetes deployment using Skaffold. See skaffold.yaml for Skaffold configuration.
- Minikube or Docker Desktop
kubectl- Skaffold
- Optional:
kustomize
The project uses Skaffold to build resources and deploy to Kubernetes. See the configuration in ./skaffold.yaml and manifests in k8s/ folder.
If you want to persist Postgres data, you can create a folder such as ~/postgres-data and mount it to Minikube:
$ mkdir ~/postgres-data
$ minikube mount ~/postgres-data:/mnt1/postgres-dataBuild images:
$ skaffold buildDeploy in development mode with hot reloading of code:
$ skaffold dev [--port-forward]You can test the deployment by making a request to localhost:8080:
$ curl http://localhost:8080/status/
{ "message": "OK" }Run build and deploy once:
$ skaffold run [--tail] [--port-forward]Delete resources:
$ skaffold deleteSee what Skaffold deploys:
$ skaffold renderConnect to Postgres at forwarded port (here assumed to be 5433):
$ psql -p 5433 -h 127.0.0.1 -Upostgres-user django-dbList pods:
$ kubectl get podsAccess Python in Django pod (replace pod name with your store pod):
$ kubectl exec $PODNAME -it -- python manage.py shellAccess psql in Postgres container:
$ kubectl exec postgres-statefulset-0 -it -- psql -Upostgres-user -ddjango-db