I added ‘+ New Endpoint’ to Endpoints in the kubeflow dashboard and registered the resources below.
kind: "InferenceService"
metadata:
annotations:
isdecar.istio.is/inject: "false"
name: "sklearn-iris"
spec:
predictor:
sklearn:
image: "kserve/sklearnserver:v0.10.0"
storageUri: "gs://kfserving-examples/models/sklearn/1.0/model"
isdecar.istio.is/inject: "false"
: Set not to use Istio Sidecar
and I verified that the status is enabled via the Dashboard UI.
- URL external:
http://sklearn-iris.pipeline.svc.cluster.local
- URL internal:
http://sklearn-iris.pipeline.svc.cluster.local/v1/models/sklearn-iris:predict
$ kubectl get InferenceService sklearn-iris -n namespace
NAME URL READY PREV LATEST PREVROLLEDOUTREVISION LATESTREADYREVISION AGE
sklearn-iris http://sklearn-iris.pipeline.svc.cluster.local True 100 sklearn-iris-predictor-default-00001 24h
Below is the python code for using my sklearn-iris example.
sklear_iris_input = dict(instances = [
[6.8, 2.8, 4.8, 1.4],
[6.0, 3.4, 4.5, 1.6]
])
import requests
import kfp
HOST = "http://127.0.0.1:8080/" # local host
# When using 'https', error
# `HTTPSConnectionPool(host='127.0.0.1', port=8080):
# Max retries exceeded with url: /v1/models/v1/models/sklearn-iris:predict (Caused by SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1131)')))`
# occurs in session.get(HOST, verify=False)
session = requests.Session()
response = session.get(HOST, verify=False)
USERNAME = "username@gmail.com"
PASSWORD = "password"
headers = {
"Content-Type" : "application/x-www-form-urlencoded", # using 'form data'
}
data = {'login': USERNAME, "password": PASSWORD}
session.post(response.url, headers = headers, data=data)
session_cookie = session.cookies.get_dict()
import json
headers = {'Host': 'sklearn-iris.pipeline.svc.cluster.local'}
res = session.post(f"{HOST}v1/models/sklearn-iris:predict",
headers = headers,
cookies = session_cookie,
data = json.dumps(sklear_iris_input))
print(res.json)
and I got <bound method Response.json of <Response [404]>>
.
I also tried with curl.
curl -v -H "Host: sklearn-iris.pipeline.svc.cluster.local" \ -d '{"instances": [[5.1, 3.5, 1.4, 0.2], [5.9, 3.0, 5.1, 1.8]]}' \ http://sklearn-iris-python2.pipeline.svc.cluster.local:80/v1/models/sklearn-iris-python2:predict
and I got this
* Could not resolve host: sklearn-iris.pipeline.svc.cluster.local * Closing connection 0 curl: (6) Could not resolve host: sklearn-iris.pipeline.svc.cluster.local
why ..?
List of things I did to solve this problem
1. Fixed kserve's ingressgateway config map assuming it is being deployed with the wrong path entered.
$ kubectl edit configmaps -n kserve inferenceservice-config
original:
...
ingress: |-
{
"ingressGateway" : "knative-serving/knative-ingress-gateway",
...
fixed to this
...
ingress: |-
{
"ingressGateway" : "kubeflow/kubeflow-gateway",
...
But problem not resolved
2. Check if the DNS server is not working properly
$ kubectl run --rm -it busybox --image=busybox:1.28 --restart=Never -- nslookup sklearn-iris.pipeline.svc.cluster.local
Server: 10.96.0.10
Address 1: 10.96.0.10 kube-dns.kube-system.svc.cluster.local
Name: sklearn-iris.pipeline.svc.cluster.local
Address 1: 10.108.6.239 knative-local-gateway.istio-system.svc.cluster.local
pod "busybox" deleted
DNS server(10.96.0.10
) is working
But problem not resolved
3. Check if the domain name is correct or not entered incorrectly.
domain name is correctly
4. Check if the network is connected
network is connected
What can I do to solve this problem?
Please help me!
versions
- Ubuntu:
20.04
- kubernetes:
1.25.00
- kubeflow:
1.7.0
- kserve:
0.9.0
,0.10.0
(I tried in both cases.)