ISTIO GRPC网关配置

问题描述 投票:0回答:1

我正在尝试使用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

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

谢谢!

grpc istio gateway
1个回答
0
投票

我在评论中提到

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

您需要更改虚拟服务hosts

spec:
  hosts:
    - "backend"

to

spec:
  hosts:
    - "*"

然后@Ondra添加他更改的另一件事是网关port number

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

© www.soinside.com 2019 - 2024. All rights reserved.