ucbrise / clipper

A low-latency prediction-serving system
http://clipper.ai
Apache License 2.0
1.39k stars 281 forks source link

Kubernetes Container Manager failing with "unexpected keyword argument 'assert_hostname'" #317

Open skidder opened 6 years ago

skidder commented 6 years ago

I'm encountering an error when initializing the Kubernetes container manager. The error message is:

TypeError: __init__() got an unexpected keyword argument 'assert_hostname'

This error occurs when establishing a connection to Kubernetes so that it can create the query-frontend, model, and Redis containers. I've provides the relevant portions of the Dockerfile and my script below.

Dockerfile contents:

FROM python:2.7.14

RUN pip install clipper_admin sklearn scikit-learn xgboost pandas numpy scipy pickleshare ipython
RUN pip install urllib3==1.22

Python script:

from __future__ import division, print_function, unicode_literals
from clipper_admin import ClipperConnection, KubernetesContainerManager
from clipper_admin.deployers import python as python_deployer

from sklearn.pipeline import Pipeline
from sklearn.preprocessing import StandardScaler
from sklearn.pipeline import FeatureUnion

import os
import xgboost as xg
import pandas as pd
import numpy as np
import pickle
import scipy

print("Starting...")
clipper_conn = ClipperConnection(KubernetesContainerManager(kubernetes_api_ip="192.168.99.100"))
clipper_conn.start_clipper(query_frontend_image="clipper/query_frontend", mgmt_frontend_image="clipper/management_frontend")

Python error output:

/usr/local/lib/python2.7/site-packages/sklearn/cross_validation.py:41: DeprecationWarning: This module was deprecated in version 0.18 in favor of the model_selection module into which all the refactored classes and functions are moved. Also note that the interface of the new CV iterators are different from that of this module. This module will be removed in 0.20.
  "This module will be removed in 0.20.", DeprecationWarning)
Starting...
Traceback (most recent call last):
  File "/xg_train.py", line 18, in <module>
    clipper_conn.start_clipper(query_frontend_image="clipper/query_frontend", mgmt_frontend_image="clipper/management_frontend")
  File "/usr/local/lib/python2.7/site-packages/clipper_admin/clipper_admin.py", line 101, in start_clipper
    cache_size)
  File "/usr/local/lib/python2.7/site-packages/clipper_admin/kubernetes/kubernetes_container_manager.py", line 76, in start_clipper
    namespace='default')
  File "/usr/local/lib/python2.7/site-packages/kubernetes/client/apis/extensions_v1beta1_api.py", line 183, in create_namespaced_deployment
    (data) = self.create_namespaced_deployment_with_http_info(namespace, body, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/kubernetes/client/apis/extensions_v1beta1_api.py", line 273, in create_namespaced_deployment_with_http_info
    collection_formats=collection_formats)
  File "/usr/local/lib/python2.7/site-packages/kubernetes/client/api_client.py", line 335, in call_api
    _preload_content, _request_timeout)
  File "/usr/local/lib/python2.7/site-packages/kubernetes/client/api_client.py", line 148, in __call_api
    _request_timeout=_request_timeout)
  File "/usr/local/lib/python2.7/site-packages/kubernetes/client/api_client.py", line 393, in request
    body=body)
  File "/usr/local/lib/python2.7/site-packages/kubernetes/client/rest.py", line 287, in POST
    body=body)
  File "/usr/local/lib/python2.7/site-packages/kubernetes/client/rest.py", line 185, in request
    headers=headers)
  File "/usr/local/lib/python2.7/site-packages/urllib3/request.py", line 70, in request
    **urlopen_kw)
  File "/usr/local/lib/python2.7/site-packages/urllib3/request.py", line 148, in request_encode_body
    return self.urlopen(method, url, **extra_kw)
  File "/usr/local/lib/python2.7/site-packages/urllib3/poolmanager.py", line 321, in urlopen
    response = conn.urlopen(method, u.request_uri, **kw)
  File "/usr/local/lib/python2.7/site-packages/urllib3/connectionpool.py", line 589, in urlopen
    conn = self._get_conn(timeout=pool_timeout)
  File "/usr/local/lib/python2.7/site-packages/urllib3/connectionpool.py", line 251, in _get_conn
    return conn or self._new_conn()
  File "/usr/local/lib/python2.7/site-packages/urllib3/connectionpool.py", line 212, in _new_conn
    strict=self.strict, **self.conn_kw)
  File "/usr/local/lib/python2.7/site-packages/urllib3/connection.py", line 125, in __init__
    _HTTPConnection.__init__(self, *args, **kw)
TypeError: __init__() got an unexpected keyword argument 'assert_hostname'
dcrankshaw commented 6 years ago

So it looks like this must be the result of this line. But I'm unable to reproduce and I'm not sure why it's causing problems.

Can you paste the output of pip list so I can see exactly which library versions are installed?

withsmilo commented 6 years ago

@skidder : I found this issue. How about set like below in your Dockerfile?

RUN pip install urllib3==1.20
Corey-Zumar commented 6 years ago

@skidder Did you manage to get this working?