Skip to content

adamako/project-ml-microservice-kubernetes

Repository files navigation

adamako

Project Overview

Prediction-app is a Python flask application that use 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.

Project goal

Operationalize machine learning microservice using kubernetes, which is an open-source system for automating the management of containerized applications.

Project features

  • Circleci for CI/CD
  • Build and run a docker image of prediction-app
  • Upload prediction-app container to docker hub
  • Deploy the container using Kubernetes and make a prediction

Some files and directories explanation

  • .circleci contains pipeline script
  • model_data/housing.csv contains sample data to predict from
  • app.py prediction program
  • requirements.txt contains application dependencies
  • output_txt_files contains sample of app running logs

Clone project

  $ git clone git@github.com:adamako/project-ml-microservice-kubernetes.git

Setup the Environment

Requirements

Install dependencies

$ cd project-ml-microservice-kubernetes/
# Run make setup to create virtualenv and activate it
$ make setup
# Run make install to install the necessary dependencies
$ make install
# Run make lint to check python script and dockerfile
$ make lint

Build container and run

# Build and run 
$ ./run_docker.sh

# Make a prediction
$ ./make_predicton.sh

Upload the container to Docker Hub

$ ./upload_docker.sh

Run in kubernetes

# Start a cluster
$ minicube start

# Run container in kubernetes (run script again after pod creation)
$ ./run_kubernetes

# Check pod status
$ kubectl get pods prediction-app

# Make a prediction (be sure web app is running on port 8000)
$ ./make_predicton.sh

# Delete the pod
$ kubectl delete pods prediction-app

# Stop the cluster and delete
$ minicube stop && minicube delete

About

Udacity Cloud DevOps Project 4

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published