【问题标题】:ISTIO GRPC Gateway configurationISTIO GRPC 网关配置
【发布时间】:2020-05-26 23:25:12
【问题描述】:

我正在尝试使用 GRPC 设置 ISTIO 网关。我使用的示例来自:https://github.com/h3poteto/istio-grpc-example

此示例不包含网关。我添加了网关:

kind: Gateway
metadata:
  name: my-gateway
  namespace: istio-grpc-example
spec:
  selector:
    istio: ingressgateway
  servers:
  - port:
      number: 80
      name: grpc-wildcard
      protocol: GRPC
    hosts:
    - "*"

并修改了 VirtualService:

apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: backend
  namespace: istio-grpc-example
spec:
  hosts:
    - "backend"
  gateways:
  - my-gateway
  http:
  - match:
    - port: 50051
    route:
    - destination:
        host: backend
        subset: v0
      weight: 90
    - destination:
        host: backend
        subset: v1
      weight: 10

还有什么我应该做的吗?我仍然无法通过网关...查询服务端点时收到错误。

谢谢!

【问题讨论】:

  • @请显示您的错误,我看到您使用的是子集,您是否定义了目标规则?
  • 他们在这个例子中没有使用网关,所以你尝试过它是否适用于默认网关吗?正如@c4f4t0r 提到的,你能显示你的错误吗?您是否尝试过使用通配符主机? ¨*¨ 而不是 ¨backend¨。
  • 谢谢大家的建议。我将端口号从 80 更改为 31400,并将主机从“后端”更改为“*”。现在看起来一切正常。

标签: grpc istio gateway


【解决方案1】:

正如我在 cmets 中提到的

您是否尝试过使用通配符主机? * 而不是 backend

您需要更改虚拟服务hosts

spec:
  hosts:
    - "backend"

spec:
  hosts:
    - "*"

而@Ondra 补充说,他改变的另一件事是网关port number

我将端口号从 80 更改为 31400,并将主机从“后端”更改为“*”。现在看起来一切正常。 – 翁德拉

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-05-07
    • 1970-01-01
    • 2021-01-10
    • 2021-06-24
    • 2019-12-30
    • 2020-05-23
    • 2021-11-14
    相关资源
    最近更新 更多