没有匹配的种类"gateway"和"virtualservice"



我使用的是Docker桌面版3.6.0,上面安装了Kubernetes 1.21.3.

我遵循本教程来开始使用Istio

https://istio.io/latest/docs/setup/getting-started/

Istio已按照说明正确安装。

现在每当我尝试应用Istio配置

通过发出命令kubectl apply -f samples/bookinfo/networking/bookinfo-gateway.yaml

我得到以下错误

unable to recognize "samples/bookinfo/networking/bookinfo-gateway.yaml": no matches for kind "Gateway" in version "networking.istio.io/v1alpha3"
unable to recognize "samples/bookinfo/networking/bookinfo-gateway.yaml": no matches for kind "VirtualService" in version "networking.istio.io/v1alpha3"

我在网上检查,发现网关和VirtualService资源失踪。

如果我执行kubectl get crd,我没有找到资源

bookinfo- gateway .yaml目录

apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
name: bookinfo-gateway
spec:
selector:
istio: ingressgateway # use istio default controller
servers:
- port:
number: 80
name: http
protocol: HTTP
hosts:
- "*"
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: bookinfo
spec:
hosts:
- "*"
gateways:
- bookinfo-gateway
http:
- match:
- uri:
exact: /productpage
- uri:
prefix: /static
- uri:
exact: /login
- uri:
exact: /logout
- uri:
prefix: /api/v1/products
route:
- destination:
host: productpage
port:
number: 9080

istio的crd应该作为istioctl安装过程的一部分安装,如果没有可用的crd,我建议重新运行安装。

>>> ~/.istioctl/bin/istioctl install --set profile=demo -y
✔ Istio core installed
✔ Istiod installed
✔ Egress gateways installed
✔ Ingress gateways installed
✔ Installation complete

kubectl get Po -n istio-system应该像

>>> kubectl get po -n istio-system
NAME                                   READY   STATUS    RESTARTS   AGE
istio-egressgateway-7ddb45fcdf-ctnp5   1/1     Running   0          3m20s
istio-ingressgateway-f7cdcd7dc-zdqhg   1/1     Running   0          3m20s
istiod-788ff675dd-9p75l                1/1     Running   0          3m32s

否则你的初始安装在某个地方出错了。

您可以在不使用https://github.com/istio/istio/blob/master/manifests/charts/base/crds/crd-all.gen.yaml的istioctl install的情况下将CRD应用到您的集群

kubectl apply -f ./crd-all.gen.yaml

相关内容

  • 没有找到相关文章

最新更新