I followed the example at: https://github.com/SeldonIO/seldon-core/tree/master/examples/kubeflow
Steps Done:
- kubectl port-forward $(kubectl get pods -l istio=ingressgateway -n istio-system -o jsonpath='{.items[0].metadata.name}') -n istio-system 8005:80
- kubectl create namespace kubeflow-user-example-com
- kubectl config set-context $(kubectl config current-context) --namespace=kubeflow-user-example-com
- Create a language wrapper for the seldon model
- Uploaded it to the docker registry
I would like to curl my SeldonDeployment in Kubeflow:
apiVersion: machinelearning.seldon.io/v1
kind: SeldonDeployment
metadata:
labels:
app: seldon
name: seldon-sentiment
namespace: kubeflow-user-example-com
spec:
annotations:
project_name: NLP Pipeline
deployment_version: v1
name: seldon-sentiment
predictors:
- componentSpecs:
- spec:
containers:
- image: 'localhost:5000/seldon-sentiment:0.1'
imagePullPolicy: IfNotPresent
name: sentiment
resources:
requests:
memory: 1Mi
terminationGracePeriodSeconds: 20
graph:
children: []
endpoint:
type: REST
name: sentiment
type: MODEL
name: sentiment
replicas: 1
annotations:
predictor_version: v1
When I try to query the deployment via curl, I am redirected to Dex.
curl -k -O http://localhost:8005/seldon/kubeflow-user-example-com/seldon-sentiment-sentiment-0-sentiment/api/v0.1/predictions -d "{'data': { 'ndarray': ['Hello world this is a test']}}" -H 'Content-Type: application/json'
* Trying ::1:8005...
* TCP_NODELAY set
* Connected to localhost (::1) port 8005 (#0)
> POST /seldon-sentiment-sentiment-0-sentiment/api/v0.1/predictions HTTP/1.1
> Host: localhost:8005
> User-Agent: curl/7.68.0
> Accept: */*
> Content-Type: application/x-www-form-urlencoded
> Content-Length: 54
>
* upload completely sent off: 54 out of 54 bytes
* Mark bundle as not supporting multiuse
< HTTP/1.1 302 Found
< location: /dex/auth?client_id=kubeflow-oidc-authservice&redirect_uri=%2Flogin%2Foidc&response_type=code&scope=profile+email+groups+openid&state=MTY2NTk2MTY
< date: Sun, 16 Oct 2022 23:07:52 GMT
< x-envoy-upstream-service-time: 2
< server: istio-envoy
< content-length: 0
<
* Connection #0 to host localhost left intact
You will need to give an authentication token if you want to curl the API. This can be done by fetching the token generated in the cookie. Dex has python codes to fetch the token and then you can curl the URL with the retrieved token in the headers.