Skip to content

smriti111/django-postgresql-kubernetes

Repository files navigation

django-postgresql-kubernetes

This is a Django, with database PostgreSQL Docker/ Kubernetes cluster

django_kubernetes

Django application deployed with Kubernetes

To run the web app locally

First install the dependencies

    pip install -r requirements.txt

To start the django app locally

  python manage.py runserver

Go to url

http://localhost:8000

Django-app deployment in kubernetes

To start the docker-container use command>

docker-compose up

The app starts at port number 8020

http://localhost:8020

Use Kubernetes to deploy enviornmental variables used by web-app

kubectl apply -f ./kubernetes/secret.yml
kubectl create -f ./kubernetes/config_map.yml

Use Kubernetes to create persistan-volume, persistant-volume-claim deployment and service resources for database

kubectl apply -f ./kubernetes/postgre/component_postgre.yml

To check the status of pods:

kubectl get pod

To check the service

kubectl get service

Use Kubernetes to create deployment and service resources for django app

kubectl apply -f ./kubernetes/django/component_postgre.yml

Running the app using an external ip address

minikube get service django-rest-service --url

Running the app using ingress

start the ingress controller

minikube addons enable ingress

To view the ingress resources

minikube get pods -n ingress-nginx

makesure to map the host name to minikube IP in /etc/host file

In this case that shall be

minikube_IP django.postgre.com

Use Kubernetes to create ingress resources for django app

kubectl apply -f ./kubernetes/ingress_service.yml

About

This is a Django, with database PostgreSQL Docker/nginx/ Kubernetes cluster

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published