Skip to content

Deploy containers to Kubernetes#206

Closed
feynmanliang wants to merge 25 commits intoucbrise:developfrom
feynmanliang:k8s
Closed

Deploy containers to Kubernetes#206
feynmanliang wants to merge 25 commits intoucbrise:developfrom
feynmanliang:k8s

Conversation

@feynmanliang
Copy link
Contributor

@feynmanliang feynmanliang commented Jun 8, 2017

  • Adds K8s as a hard dependency, using minikube for local development
  • Removes docker-compose dependency (all Clipper resources are provided on the k8s cluster)
  • Removes fabric dependency (remote administration is done through K8s api now The R container that was added (R model deployment #195) reintroduced this
  • Adds ClipperK8s class to handle Kubernetes interface

To test:

  • Configure local k8s cluster using minikube
minikube start --insecure-registry localhost:5000
eval $(minikube docker-env)
  • Run the following code:
from subprocess import Popen, PIPE
import numpy as np
import clipper_admin

# Sets host to be minikube's virtualbox network interface
clipper_host_public_ip = Popen(['minikube', 'ip'], stdout=PIPE).communicate()[0].strip()

clipper = clipper_admin.Clipper(host=clipper_host_public_ip)
clipper.start() # starts clipper query managers in k8s

Clipper and its components should be deployed to minkube

  • Run kubectl get svc to get the k8s service port mappings. Substitute in the corresponding values into clipper_manager.py (this could be improved by making it a constructor argument)

  • To deploy to clipper on k8s:

clipper.register_application("hello_world", "feature-sum-model", "doubles", "-1.0", 100000)
def feature_sum_function(xs):
      return [str(np.sum(x)) for x in xs]

# serializes predict function, builds docker images, creates k8s deployment which registers with query manager
clipper.deploy_predict_function("feature-sum-model", 5, feature_sum_function, "doubles")
  • Test the endpoint by POSTing queries to $(minikube ip):1337/hello_world/predict

  • Cluster resources can be deprovisioned with clipper.stop_all()


This change is Reviewable

@AmplabJenkins
Copy link

Can one of the admins verify this patch?

@feynmanliang feynmanliang changed the title [WIP] Deploy containers to Kubernetes Deploy containers to Kubernetes Jun 30, 2017
* develop:
  Wording fix (ucbrise#234)
  RPC container content fix (ucbrise#232)
  [CLIPPER-227] Fix EWMA behavior for meters (ucbrise#228)
  One-line app registration and model deployment (ucbrise#223)
  R model deployment (ucbrise#195)
  Allow model versions to be strings (ucbrise#197)
  Base64 decoding for JSON byte data (ucbrise#214)
  Restarting on containers is no longer the default behavior (ucbrise#213)
  fixed backslash escape issue for removing remote containers (ucbrise#210)
  removed pip install findspark from run_unittests.sh (ucbrise#211)
  Fix example code in README (ucbrise#205)
@feynmanliang
Copy link
Contributor Author

@dcrankshaw ready for review

@dcrankshaw
Copy link
Contributor

I'm currently reviewing this. I'm actually refactoring it a bit and adding some additional functionality as well, which I will submit as a pull request to this branch. So let's treat this as basically a feature branch for now.

From what I've looked at so far, this looks great. The functionality I'm adding is mostly refactoring the python package and adding plain Docker support so we don't break existing workflows when this gets merged.

@dcrankshaw
Copy link
Contributor

Replaced by #251

@dcrankshaw dcrankshaw closed this Jul 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants