我正在尝试使用 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:
- "*"
并修改了虚拟服务:
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
还有什么我应该做的吗?我仍然无法通过网关...查询服务终结点时收到错误。
谢谢!
正如我在评论中提到的
您是否尝试过通配符主机?
*
而不是backend
?
您需要更改虚拟服务主机。
spec:
hosts:
- "backend"
自
spec:
hosts:
- "*"
@Ondra补充一点,他更改的另一件事是网关端口号。
我将端口号从 80 更改为 31400,并将主机从"后端"更改为"*"。现在看起来一切正常。– 昂德拉