This project deploys a Machine Learning Microservice API using Docker and Kubernetes. The Machine Learning Model is exposed by a python flask app via Web API. The model is trained to predict housing prices in Boston according to several features, such as average rooms in a home and data about highway access, teacher-to-pupil ratios.
- .circleci: It holds all CICD configurations for CircleCI build server.
- model_data: It holds the prediction model library and the prediction model data used to train the model.
- output_txt_files: It holds the output logs for the deployed and running application for both docker and kubernetes.
- app.py: The index file for starting the python flask application server.
- Dockerfile: Docker configurations for building and running the docker image based of the project.
- requirements.txt: The package dependencies for the python flask application.
- run_docker.sh: Script to build and run docker image.
- run_kubernetes.sh: Script to run docker image using kubernetes.
- upload_docker.sh: Script to upload docker image to dockerhub.
- Create a virtualenv with Python 3.7 and activate it. Refer to this link for help on specifying the Python version in the virtualenv.
python3 -m pip install --user virtualenv
# You should have Python 3.7 available in your host.
# Check the Python path using `which python3`
# Use a command similar to this one:
python3 -m virtualenv --python=<path-to-Python3.7> .devops
source .devops/bin/activate
- Run
make install
to install the necessary dependencies
- Standalone:
python app.py
- Run in Docker:
./run_docker.sh
- Run in Kubernetes:
./run_kubernetes.sh
- Setup and Configure Docker locally
- Setup and Configure Kubernetes locally
- Create Flask app in Container
- Run via kubectl