I runed code case1, case2 in local space with vscode, not Notebooks of kubeflow censtral dashboard.
I'd like to know what I'm missing.
prepared:
added user
- email: [email protected] hash: 1234 # Actually, hash value userID: "myuserid" username: myusername
added namespace
$ kubectl apply -f profile.yaml
apiVersion: kubeflow.org/v1beta1 kind: Profile metadata: name: exam-namespace spec: owner: kind: User name: [email protected] resourceQuotaSpec: {}
served model
kubeflow Central Dashboard
-Models
-+NEW MODEL SERVER
apiVersion: "serving.kserve.io/v1beta1" kind: "InferenceService" metadata: annotations: isdecar.istio.is/inject: "false" name: "sklearn-iris" spec: predictor: sklearn: image: "kserve/sklearnserver:v0.9.0" storageUri: "gs://kfserving-examples/models/sklearn/1.0/model"
what i did with python sdk
case 1.
using kfp.Client()
import kfp
import requests
HOST = "http://localhost:8080"
NAME_SPACE = "exam-namespace"
USER_NAME = "[email protected]"
USER_PS = '1234'
session = requests.Session()
response = session.get(HOST)
headers = {
"Content-Type": "application/x-www-form-urlencoded",
}
data = {"login": USER_NAME, "password": USER_PS}
session.post(response.url, headers=headers, data=data)
session_cookie = session.cookies.get_dict()["authservice_session"]
# access kubeflow dashboard
client = kfp.Client(
host=f"{HOST}/pipeline",
namespace=f"{NAME_SPACE}",
cookies=f"authservice_session={session_cookie}")
session_cookie = session.cookies.get_dict()
sklear_iris_input = dict(instances = [
[6.8, 2.8, 4.8, 1.4],
[6.0, 3.4, 4.5, 1.6]
])
headers = {'Host': "http://sklearn-iris.project-pipeline.example.com"}
res = session.post(f"{HOST}/v1/models/v1/models/sklearn-iris:predict",
headers = headers,
cookies = session_cookie,
data = json.dumps(sklear_iris_input))
print(f"res.json : {res.json}")
and, got this..
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)')))
case 2.
using KServeClient()
import requests
import json
from kserve import utils, KServeClient
NAME_SPACE = "exam-namespace"
SERVICE_NAME = "sklearn-iris"
kserve = KServeClient()
isvc_resp = kserve.get(SERVICE_NAME, namespace = NAME_SPACE)
# http://sklearn-iris.exam-namespace.svc.cluster.local/v1/models/sklearn-iris:predict
isvc_url = isvc_resp['status']['address']['url']
sklear_iris_input = dict(instances = [
[6.8, 2.8, 4.8, 1.4],
[6.0, 3.4, 4.5, 1.6]
])
response = requests.post(isvc_url, json = json.dumps(sklear_iris_input))
print(response.text)
and, got this..
HTTPConnectionPool(host='sklearn-iris-test2.project-pipeline.svc.cluster.local', port=80):
Max retries exceeded with url: /v1/models/sklearn-iris-test2:predict (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fe70aa8e9a0>: Failed to establish a new connection: [Errno -2] Name or service not known'))
- After adding a new user to
dex
and creating a namespace viaprofile.yaml
, do I need to add specific information to theAuthorizationPolicy
? - I installed kubernetes and kubeflow on this desktop and port-forwarded through istio-ingressgate. And I ran the code case1,case2 in locally, is there any problem with setting host to
localhost:8080
? - If the above two questions don't have anything I need to do, how should the
HTTPConnectionPool
be resolved?