An ingress gateway service provides a unified entrance for routing the inbound traffic at Layer 7. It routes HTTP requests from the same TCP-based port to different Kubernetes Services based on the request content. This topic describes how to configure an Istio gateway for multiple ingress gateway services in a Service Mesh (ASM) instance.
Prerequisites
An ASM instance of v1.13.4.46-ge6c4b142-aliyun or later is created. For more information, see Create an ASM instance.
- The cluster is added to the ASM instance. For more information, see Add a cluster to an ASM instance.
At least two ingress gateway services are deployed. For more information, see Create an ingress gateway service.
- An application is deployed in the ASM instance. For more information, see Deploy an application in an ASM instance.
Background information
In this example, two A records are configured for the xxx.xxx.cn
domain name. The two A records correspond to two Server Load Balancer (SLB) instances. The two SLB instances correspond to two ingress gateway services in an ASM instance. The two ingress gateway services require the same Istio gateway. To ensure that the two ingress gateway services share the same Istio gateway, you need to associate an Istio gateway with both ingress gateway services one by one. ASM allows you to configure an Istio gateway for multiple ingress gateway services in a few steps. This simplifies the configuration of the Istio gateway.
Procedure
You can map an Istio gateway to multiple ingress gateway services. The spec.selector
field of a Gateway resource is used to select the ingress gateways with which the Istio gateway will be associated. Ingress gateways with a label that match the selector are selected. In this example, the label key1: value1
is specified as the selector.
- Log on to the ASM console. In the left-side navigation pane, choose .
- On the Mesh Management page, click the name of the ASM instance. In the left-side navigation pane, choose .
On the Ingress Gateway page, find each of the ingress gateway services with which you want to associate an Istio gateway and click YAML .
In the Edit dialog box, set the
podLabels
field and click OK.... spec: podLabels: key1: value1 ...
Associate an Istio gateway with the ingress gateway services.
On the details page of the ASM instance, choose in the left-side navigation pane.
On the Gateway page, find the Istio gateway that you want to associate with the ingress gateway services and click YAML in the Actions column.
In the Edit dialog box, set the
spec.selector
field and click OK.apiVersion: networking.istio.io/v1beta1 kind: Gateway metadata: name: bookinfo-gateway namespace: default spec: selector: key1: value1 servers: - hosts: - '*' port: name: http number: 80 protocol: HTTP