我正在尝试使用两种不同的协议(GRPC和HTTP)配置istio GateWay
现在,我有两个不同的网关,分别用于GRPC和HTTP,如下所示
apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
name: gwgrpc
spec:
selector:
istio: ingressgateway
servers:
- port:
number: 7878
name: http
protocol: GRPC
hosts:
- "*"
---
apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
name: gwrest
spec:
selector:
istio: ingressgateway
servers:
- port:
number: 7979
name: http
protocol: HTTP
hosts:
- "*"
是否可以使用具有不同协议和端口的同一网关?
答案 0 :(得分:1)
您应该能够将两个网关结合在一起。唯一的问题是两个端口都具有相同的名称。这样的事情应该起作用。
apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
name: gwgrpc
spec:
selector:
istio: ingressgateway
servers:
- port:
number: 7878
name: grpc
protocol: GRPC
hosts:
- "*"
- port:
number: 7979
name: http
protocol: HTTP
hosts:
- "*"
答案 1 :(得分:1)
您可能希望使用this example作为模板。同意@Frank:您需要更改名称。 这是示例配置的一小部分
apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
name: my-gateway
spec:
selector:
app: my-gatweway-controller
servers:
- port:
number: 80
name: http
protocol: HTTP
hosts:
- uk.bookinfo.com
- eu.bookinfo.com
tls:
httpsRedirect: true # sends 301 redirect for http requests
- port:
number: 443
name: https
protocol: HTTPS
hosts:
- uk.bookinfo.com
- eu.bookinfo.com