【问题标题】:No matches for kind"gateway" and "virtualservice"kind“网关”和“虚拟服务”没有匹配项
【发布时间】:2021-11-26 09:15:24
【问题描述】:

我正在使用具有 Kubernetes 1.21.3 的 Docker Desktop 版本 3.6.0。

我正在按照本教程开始使用 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"

我上网查了一下,发现Gateway和VirtualService资源都不见了。

如果我执行kubectl get crd 我找不到资源

bookinfo-gatway.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

【问题讨论】:

    标签: kubernetes istio docker-desktop


    【解决方案1】:

    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
    

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

    【讨论】:

    • 我的 istio 安装有问题...谢谢
    猜你喜欢
    • 2018-07-12
    • 2021-08-20
    • 2019-09-14
    • 2019-10-20
    • 1970-01-01
    • 1970-01-01
    • 2019-08-12
    • 2021-10-18
    • 1970-01-01
    相关资源
    最近更新 更多