我正在尝试使用两种不同的协议(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:
- "*"
是否可以使用具有不同协议和端口的同一网关?
您应该能够组合这两个网关。唯一的问题是两个端口具有相同的名称。这样的事情应该有效。
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:
- "*"
您可能希望将此示例用作模板。同意@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