kservert安装部署

1.版本要求

Kubernetes Version
Recommended Istio Version
1.27 1.18, 1.19
1.28 1.19, 1.20
1.29 1.20, 1.21

2.安装istio,cert manager(master1)

#安装istio
 wget https://github.com/istio/istio/releases/download/1.23.3/istioctl-1.23.3-linux-amd64.tar.gz
 tar -zxvf istio-1.23.3-linux-amd64.tar.gz
 cd ./istio-1.23.3/bin
 mv istioctl /usr/local/bin/
 istioctl install
#ingress-controller  安装
apiVersion: networking.k8s.io/v1
kind: IngressClass
metadata:
  name: istio
spec:
  controller: istio.io/ingress-controller
 
kubectl apply -f istio_ingress.yaml
#安装cert manager
kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.16.1/cert-manager.yaml
kubectl get pods --namespace cert-manager

 

3.安装knative

kubectl apply -f https://github.com/knative/operator/releases/download/knative-v1.16.0/operator.yaml
#查看是否部署成功
 kubectl get deployment  -n knative-operator
#安装kantive server
apiVersion: v1
kind: Namespace
metadata:
  name: knative-serving
---
apiVersion: operator.knative.dev/v1beta1
kind: KnativeServing
metadata:
  name: knative-serving
  namespace: knative-serving
 
kubectl apply -f kanative-server.yaml
#验证
kubectl get deployment -n knative-serving
kubectl get KnativeServing knative-serving -n knative-serving
 
#安装knative event
apiVersion: v1
kind: Namespace
metadata:
  name: knative-eventing
---
apiVersion: operator.knative.dev/v1beta1
kind: KnativeEventing
metadata:
  name: knative-eventing
  namespace: knative-eventing
 
kubectl apply -f kanative-event.yaml
#验证
kubectl get deployment -n knative-eventing
kubectl get KnativeEventing knative-eventing -n knative-eventing

 

4.安装kserver

kubectl apply -f https://github.com/kserve/kserve/releases/download/v0.13.0/kserve.yaml
#验证
kubectl create namespace kserve-test
 
kubectl apply -n kserve-test -f - <<EOF
apiVersion: "serving.kserve.io/v1beta1"
kind: "InferenceService"
metadata:
  name: "sklearn-iris"
spec:
  predictor:
    model:
      modelFormat:
        name: sklearn
      storageUri: "gs://kfserving-examples/models/sklearn/1.0/model"
EOF
#检查
kubectl get inferenceservices sklearn-iris -n kserve-test
 
#确定入口 IP 和端口
kubectl get svc istio-ingressgateway -n istio-system
#如果设置了 EXTERNAL-IP 值,则您的环境有一个外部负载均衡器,可以将其用于入口网关。
export INGRESS_HOST=$(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
export INGRESS_PORT=$(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.spec.ports[?(@.name=="http2")].port}')
 
#进行推理
cat <<EOF > "./iris-input.json"
{
  "instances": [
    [6.8,  2.8,  4.8,  1.4],
    [6.0,  3.4,  4.5,  1.6]
  ]
}
EOF
#验证预测
curl -v -H "Content-Type: application/json" http://sklearn-iris.kserve-test.${CUSTOM_DOMAIN}/v1/models/sklearn-iris:predict -d @./iris-input.json
#运行性能测试
kubectl create -f https://raw.githubusercontent.com/kserve/kserve/release-0.11/docs/samples/v1beta1/sklearn/v1/perf.yaml -n kserve-test
kubectl logs load-test8b58n-rgfxr -n kserve-test
 

 

posted @ 2024-11-07 15:54  暗痛  阅读(2)  评论(0编辑  收藏  举报