Description
Validation Checklist
- Is this a Kubeflow issue?
- Are you posting in the right repository ?
- Did you follow the installation guide https://github.com/kubeflow/manifests?tab=readme-ov-file ?
- Is the issue report properly structured and detailed with version numbers?
- Is this for Kubeflow development ?
- Would you like to work on this issue?
- You can join the CNCF Slack and access our meetings at the Kubeflow Community website. Our channel on the CNCF Slack is here #kubeflow-platform.
Version
master
Describe your issue
From @kromanow94
I did some investigation and I found out that this is because the VirtualServices
created by kserve
are configured by default to use cluster-local-gateway
. istio-ingressgateway
is configured with AuthorizationPolicy
istio-ingressgateway-oauth2-proxy
which enforces the traffic to go through oauth2-proxy
. There is no such AuthorizationPolicy
for cluster-local-gateway
.
So, I see two options:
- Configure Istio auth for current setup with
cluster-local-gateway
- Create
cluster-local-gateway-oauth2-proxy
AuthorizationPolicy
to enforce authentication withoauth2-proxy
:apiVersion: security.istio.io/v1 kind: AuthorizationPolicy metadata: name: cluster-local-gateway-oauth2-proxy namespace: istio-system spec: action: CUSTOM provider: name: oauth2-proxy rules: - {} selector: matchLabels: app: cluster-local-gateway
- Depending on your setup, if the model is deployed in Kubeflow managed namespace (KF Profile, for example
kubeflow-user-example-com
), you also have to configure access to thesklearn-iris
deployment:apiVersion: security.istio.io/v1beta1 kind: AuthorizationPolicy metadata: name: sklearn-iris-predictor-allow namespace: kubeflow-user-example-com spec: selector: matchLabels: serving.knative.dev/service: sklearn-iris-predictor action: ALLOW rules: - {}
- Testing with
curl
:$ curl -XPOST -v "http://sklearn-iris.kubeflow-user-example-com.svc.cluster.local/v1/models/sklearn-iris:predict" -H "Authorization: Bearer $(cat /run/secrets/kubernetes.io/serviceaccount/token)" -d '{"instances": [[6.8, 2.8, 4.8, 1.4], [6.0, 3.4, 4.5, 1.6]]}' -H "Content-Type: application/json" Note: Unnecessary use of -X or --request, POST is already inferred. * Host sklearn-iris.kubeflow-user-example-com.svc.cluster.local:80 was resolved. * IPv6: (none) * IPv4: 172.20.1.23 * Trying 172.20.1.23:80... * Connected to sklearn-iris.kubeflow-user-example-com.svc.cluster.local (172.20.1.23) port 80 > POST /v1/models/sklearn-iris:predict HTTP/1.1 > Host: sklearn-iris.kubeflow-user-example-com.svc.cluster.local > User-Agent: curl/8.7.1 > Accept: */* > Authorization: Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6Ikh3ZUQ2enNYYnRZNUFZQk8xX1ZKc3ZCZGwwRmR3dTdwRURiQXpDN3c5MncifQ.eyJhdWQiOlsiaHR0cHM6Ly9rdWJlcm5ldGVzLmRlZmF1bHQuc3ZjLmNsdXN0ZXIubG9jYWwiLCJodHRwczovL2t1YmVybmV0ZXMuZGVmYXVsdC5zdmMiLCJodHRwczovL2t1YmVybmV0ZXMuZGVmYXVsdCJdLCJleHAiOjIwMjg1NDA4NzAsImlhdCI6MTcxMzE4MDg3MCwiaXNzIjoiaHR0cHM6Ly9rdWJlcm5ldGVzLmRlZmF1bHQuc3ZjLmNsdXN0ZXIubG9jYWwiLCJrdWJlcm5ldGVzLmlvIjp7Im5hbWVzcGFjZSI6Imt1YmVmbG93LXVzZXItZXhhbXBsZS1jb20iLCJwb2QiOnsibmFtZSI6ImN1cmwiLCJ1aWQiOiI3ZGI2ZjliNC0zZTliLTQ3ZDUtOWI4ZC0yZjhiMWVkNTVhZjkifSwic2VydmljZWFjY291bnQiOnsibmFtZSI6ImRlZmF1bHQtZWRpdG9yIiwidWlkIjoiODZhZmM3OGYtMTIzYS00MDMwLWI5YjQtZDllYWQ5YmE2NTc4In19LCJuYmYiOjE3MTMxODA4NzAsInN1YiI6InN5c3RlbTpzZXJ2aWNlYWNjb3VudDprdWJlZmxvdy11c2VyLWV4YW1wbGUtY29tOmRlZmF1bHQtZWRpdG9yIn0.iY9WY7vqFQvxv3mzFYlnKQ3arG631movAfkIM1eWH_UdsQuWUupIz7wak81pOM23gBPpYxMT5HR1ZgVHYWG07Neh4e1ySUzhmPNNfydSIs-jUP1P8BjEPq3BdSQ9j_1pGggMDXFM4msFnEdAjlmpl23yDKOoJCj0RDV3fZIiA-mf7wLyiv_E38ah1ygZXYjrTCdzstCH02aZ7VCLc1dPETttE7nlF3YoaurwHJzZF6WHXmQlVdU2yMg0RT8uRDBUDI6WTq_guxjuEBEJrj166pXbp1MBvslMBUYXPV3StQ-AXnvQUyCBDoa5NOlJKOht3UOhGeS_-1A50ctjsl8xKw > Content-Type: application/json > Content-Length: 65 > * upload completely sent off: 65 bytes < HTTP/1.1 200 OK < content-length: 21 < content-type: application/json < date: Mon, 15 Apr 2024 12:47:28 GMT < server: envoy < x-envoy-upstream-service-time: 9 < * Connection #0 to host sklearn-iris.kubeflow-user-example-com.svc.cluster.local left intact {"predictions":[1,1]}
- Create
- Change the kserve config to use
istio-ingressgateway
instead ofcluster-local-gateway
. This touches kserve which I don't have a lot of experience with. I tried changing theinferenceservice-config
ConfigMap
to define the"localGatewayService": "istio-ingressgateway.istio-system.svc.cluster.local"
and"localGateway": "kubeflow/kubeflow-gateway"
but that didn't work for some reason, probably something is missing...
@juliusvonkohout do you think we should add this AuthorizationPolicy
for cluster-local-gateway
to the manifests?
Steps to reproduce the issue
See above
Put here any screenshots or videos (optional)
No response
Metadata
Metadata
Assignees
Type
Projects
Status
To Do