Part1: Deploy a Simple Web Application with Kubernetes
In this report, a simple web application with Fastapi is going to be developed. Then it would be dockerized and pushed to a local docker-registery. In kubernetes file, the docker file is pull from docker-registery and get up and running. This web app does not have any dependencies like database, message broker and etc. This project is available at this github repository.
Docker Registery
The docker-compose file is available here. Follow the Readme and update the docker daemon.json file. Then the dockerfile should be tagged and pushed to the docker-registery; the procedure is explained in README. After successful pushing; check registery with this url.
Deployment & Service
First minikube should be stopped, deleted and start with this command:
> minikube start — insecure-registry=”10.10.0.1:5000"
The 5000 is port of docker-registery and the host is the gateway that could be found from:
> docker network inspect bridge
After a successful start, the deployment and service is going to be starts with kubectl command. The service is going to create a port for outside of kubernetes cluster.
After changing directory to k8s we have deployment and service; start them with:
> kubectl apply -f .
We can check the status by:
> kubectl get all
See logs of a pod by:
> kubectl logs -f [name]
Results
First find minikube IP:
> minikube ip
The by going to the port that we set service; in fastapi docs we have: