1、在 Kubernetes 集群中安装 Istio 1.15.3 版本。您可以使用以下命令安装 Istio:
$ curl -L https://istio.io/downloadIstio | ISTIO_VERSION=1.15.3 TARGET_ARCH=x86_64 sh -
$ cd istio-1.15.3
$ export PATH=$PWD/bin:$PATH
$ istioctl install --set profile=default
2、安装 Knative:
$ kubectl apply --filename https://github.com/knative/serving/releases/download/v0.31.0/serving-crds.yaml
$ kubectl apply --filename https://github.com/knative/serving/releases/download/v0.31.0/serving-core.yaml
$ kubectl apply --filename https://github.com/knative/net-istio/releases/download/v0.22.0/release.yaml
3、配置 Knative 和 Istio 之间的关联:
$ kubectl label namespace default istio-injection=enabled
4、检查 Knative 是否安装成功:
$ kubectl get pods --namespace knative-serving
这将显示 Knative 服务中的所有 Pod。如果所有 Pod 都已准备就绪,那么 Knative 就已成功安装。
5、测试 Knative 是否正常工作:
$ kubectl apply --filename https://raw.githubusercontent.com/knative/docs/main/docs/serving/samples/hello-world/helloworld.yaml
$ kubectl get ksvc helloworld --output=custom-columns=NAME:.metadata.name,DOMAIN:.status.domain
这将输出 HelloWorld 服务的域名。您可以在 Web 浏览器中访问该域名,以验证 Knative 是否正常工作。