1. Gateway案例:
下面的例子显示了一个可能的网关配置为外部HTTPS进入流量:
apiVersion: networking.istio.io/v1alpha3kind: Gatewaymetadata:name: ext-host-gwyspec:selector:app: my-gateway-controllerservers:- port:number: 443name: httpsprotocol: HTTPShosts:- ext-host.example.comtls:mode: SIMPLEserverCertificate: /tmp/tls.crtprivateKey: /tmp/tls.key
此网关配置允许来自ext-host.example.com的HTTPS流量进入端口443上的网格,但不为流量指定任何路由。
要指定路由并使网关按预期工作,还必须将网关绑定到虚拟服务。您可以使用虚拟服务的网关字段来实现这一点,如下面的示例所示:
apiVersion: networking.istio.io/v1alpha3kind: VirtualServicemetadata:name: virtual-svcspec:hosts:- ext-host.example.comgateways:- ext-host-gwy
然后可以使用外部通信流的路由规则配置虚拟服务。
