按照文档,我尝试设置 Seldon-Core 快速入门https://docs.seldon.io/projects/seldon-core/en/v1.11.1/workflow/github-readme.html
我没有 LoadBalancer,所以我想使用端口转发来访问服务。
我运行以下脚本来设置系统:
#!/bin/bash -ev
kind create cluster --name seldon
kubectl cluster-info --context kind-seldon
sleep 10
kubectl get pods -A
istioctl install -y
sleep 10
kubectl get pods -A
kubectl create namespace seldon-system
kubens seldon-system
helm install seldon-core seldon-core-operator \
--repo https://storage.googleapis.com/seldon-charts \
--set usageMetrics.enabled=true \
--namespace seldon-system \
--set istio.enabled=true
sleep 100
kubectl get validatingwebhookconfigurations
kubectl create namespace modelns
kubens modelns
kubectl apply -f - << END
apiVersion: machinelearning.seldon.io/v1
kind: SeldonDeployment
metadata:
name: iris-model
namespace: modelns
spec:
name: iris
predictors:
- graph:
implementation: SKLEARN_SERVER
modelUri: gs://seldon-models/v1.12.0-dev/sklearn/iris
name: classifier
name: default
replicas: 1
END
sleep 100
kubectl get pods -A
kubectl get svc -A
INGRESS_GATEWAY_SERVICE=$(kubectl get svc --namespace istio-system --selector="app=istio-ingressgateway" --output jsonpath='{.items[0].metadata.name}')
kubectl port-forward --namespace istio-system svc/${INGRESS_GATEWAY_SERVICE} 8080:80 &
我猜端口转发参数8080:80
可能是错误的。
我正在使用以下脚本进行测试:
#!/bin/bash -ev
export INGRESS_HOST=localhost
export INGRESS_PORT=8080
SERVICE_HOSTNAME=$(kubectl get inferenceservice sklearn-iris -n kserve-test -o jsonpath='{.status.url}' | cut -d "/" -f 3)
curl -X POST http://$INGRESS_HOST:$INGRESS_PORT/seldon/modelns/iris-model/api/v1.0/predictions \
-H 'Content-Type: application/json' \
-d '{ "data": { "ndarray": [1,2,3,4] } }'
但我收到以下错误:
Handling connection for 8080
E1012 10:52:32.074812
52896 portforward.go:400] an error occurred forwarding 8080 -> 8080:
error forwarding port 8080 to pod b9bd4ff03c6334f4af632044fe54e1c2531e95976a5fe074e30b4258d145508a,
uid : failed to execute portforward in network namespace "/var/run/netns/cni-2b4d8573-3cfe-c70e-1c36-e0dc53cbd936": failed to connect to localhost:8080 inside namespace "b9bd4ff03c6334f4af632044fe54e1c2531e95976a5fe074e30b4258d145508a",
IPv4: dial tcp4 127.0.0.1:8080: connect: connection refused IPv6 dial tcp6 [::1]:8080: connect: connection refused
请问有人知道如何解决这个问题吗?什么是正确的端口转发参数?