Circle CI status badge:
In this project, I operationalized a Machine Learning microservice API, containerized it and deployed to a Kubernetes cluster. I also set up continuous integration on Circle CI.
This project contains a sklearn
model that has been 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, and so on. You can read more about the data, which was initially taken from Kaggle, on the data source site. This project could be extended to any pre-trained machine learning model, such as those for image recognition and data labeling.
- Clone the repository
To run in Docker
, you need to have Docker
installed and running on the host and then:
- Run
bash run_docker.sh
. This would build the image using theDockerfile
and run the container on your host, forwarding traffic from port80
in the container to post8080
on your host.
To run in a Kubernetes pod, you need to have minikube
installed and started on the host. minikube
requires a virtualization tool such as virtual box, so you need to install that too. You can start minikube
using minikube start
and make use of the default cluster for deployments.:
- Run
bash run_kubernetes.sh
. This will run the container in a Kubernetes pod and forward traffic from port80
in the container to post8080
on your host
That's it
- Run
bash make_prediction.sh
- Install python 3.7
- Run
make setup
to set up a venv and activate it - Install dependencies with
make install
- To lint the code run
make lint
- Run the server with
python3 app.py
- Change
$PORT
inmake_prediction.sh
to80
and runbash make_prediction.sh
to call the API