This project involves operationalizing a machine learning microservice API. The API was built using Python
and Flask
(a python web framework). The API basically predicts housing prices in Boston using a provided pre-trained scikit-learn
model. You can read more about the data, which was initially taken from Kaggle, on the data source site
Your project goal is to operationalize this working, machine learning microservice using kubernetes, which is an open-source system for automating the management of containerized applications. In this project you will:
- Test your project code using linting
- Complete a Dockerfile to containerize this application
- Deploy your containerized application using Docker and make a prediction
- Improve the log statements in the source code for this application
- Configure Kubernetes and create a Kubernetes cluster
- Deploy a container using Kubernetes and make a prediction
- Upload a complete Github repo with CircleCI to indicate that your code has been tested
You can find a detailed project rubric, here.
The final implementation of the project will showcase your abilities to operationalize production microservices.
- 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`
# To create the virtual environment
$ python3 -m venv ~/.devops
# To activate the virtual environment
$ source ~/.devops/bin/activate
- Run
make install
to install the necessary dependencies
- Standalone:
python app.py
- Run in Docker
# Ensure you have docker installed
$ chmod +x run_docker.sh
$ ./run_docker.sh
- Run in Kubernetes
# Ensure you have kubectl installed and minikube for creating a local Kubernetes cluster
$ chmod +x run_kubernetes.sh
$ ./run_kubernetes.sh
- Upload the docker image to dockerhub
$ chmod +x ./upload_docker.sh
$ ./upload_docker.sh
- Setup and Configure Docker locally
- Setup and Configure Kubernetes locally
- Create Flask app in Container
- Run via kubectl