Skip to content

sayedh/python-flask-docker-kubernetes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Deploying a Dockerized Flask app into Kubernetes Pods with Load Balancing

In this project I used a simple Flask app that lists the instance ID, dockerized it, and put it into pods that are load balanced. So when the Flask app is refreshed you can see that it is a new instance ID meaning that it changed pods. Pods

Technologies Used

  • Flask
  • Docker
  • Kubernetes

Dependencies

Executing program

  • Download the repository to your computer go to project file
git clone https://github.com/sayedh/python-flask-docker-kubernetes
cd python-flask-docker-kubernetes
  • Run the Flask app
flask run
  • Build the Docker image and run it
docker build -t flask-app-testing .
docker run --name test-flask -p 5000:5000 flask-app-testing
  • Now start Kubernetes and load the docker image
minikube start
minikube image load flask-app-testing
  • Apply the YAML files and run the app
kubectl apply -f kubernetes/flask_deployment.yaml
kubectl apply -f kubernetes/flask_service.yaml
minikube service flask-app-service –url
  • Now if your refresh the page, you will see that the instance ID changes meaning the pods change. InstanceChange

  • Use this command to change the number of pods. You go up or down in the number of pods.

kubectl scale deployment flask-app --replicas=10
  • You can also view the Kubernetes dashboard with this command
minikube dashboard

Dashboard

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published