Part2: Deploy a more complex web application with Kubernetes

Alireza Moosavi
2 min readJul 3, 2020

In the Part1, the procedure of push dockerfile to private docker-registory was illustrated. Also a simple web app deployed and described. In this report, a more complex web app is going to be analysed and deployed. The whole code is available in this github repository.

This project uses the postgresql for saving users sign in, informations. Therefore; two deployment and two services needs to be developed, each for web application and posgresql database. The deployment process is the same that presented in part1. The postgre deployment and service could b found in this file. The host name for postgresql is determined like this:

<service-name>.<namespace>.svc.<internal-cluster-default-domain>

So in this application we have:

postgresql-svc.default.svc.cluster.local

The data base url should be determined in env file in deployment of web app:

Database URL

Deploying

After tagging and pushing to docker-registery we have:

> kubectl apply -f k8s/postgre/

>kubectl apply -f k8s/web/services.yaml

>kubectl apply -f k8s/web/deployment.yaml

Now app is creating:

kubectl get all

After running postgres, web app will work; we go to api docs address with minikube ip:

Posting data
Get the data

--

--