This project is a Python flask application, that is containerized by docker and deployed using Kubernetes.
The Architecture of the project will flow like this:

To successfully build, package and deploy the application, the following needs to be installed on your machine - either local machine or virtual machine:
- Docker: the containerization engine. Click HERE to install docker.
- Minikube: a local kubernetes installation which makes it easy to learn and develop applications on kubernetes easily. Click HERE to install minikube.
- Kubectl: a command line utility to interact with kubernetes clusters. Install kubectl from HERE
- VS code: code editor to build your code and configuration files. Install VS Code from HERE
Create an app.py file on your vscode and write a simple python code using flask framework to return Hello JT...Welcome to Kodecamp to the screen
Then create another file called reuirements.txt to store your major application requirement. Here, we have just one requirement which is flask:
After creating the application source code, and the requirements file, we will write a Dockerfile to containerize the application using a python slim image
To build the docker image, run this simple command
docker build -t johntoby/python-app .
This will build the application image named johntoby/python-app
To run the application locally using docker and expose it on port 5000, we will run the following command:
docker run -it -p 5000:5000 johntoby/python-app
Since the application is running on an ec2 instance, I will browse the public ip of my ec2 instance on port 5000 i.e. 54.89.171.65:5000
This confirms the application is successfully dockerized and running on port 5000.
Login to dockerhub and authenticate to your CLI. Then run this command to push the local image to dockerhub
docker push johntoby/python-app
We will use minikube to deploy the application on kubernetes.
Run this command to start minikube
minikube start
Create deployment.yaml file to deploy the image
run this command to check if your deployment is created successfully
kubectl get deployment
Create your service.yaml file to expose the application on port 5000

Run this command to check if your service is successfully created
kubectl get service
To check the service, run this command
minikube service
Finally, to port-forward the service to be able to view it on the browser, run this command:
kubectl port-forward service/kodecamp-service 5000:5000
The application should be available on the browser at localhost:5000
Thanks.












