You can associate multiple Server Load Balancer (SLB) instances with a Service Mesh (ASM) gateway so that multiple SLB instances can be used to access the ASM gateway. This topic describes how to access an ASM gateway by using multiple SLB instances that are associated with the ASM gateway.
Prerequisites
- The cluster is added to the ASM instance. For more information, see Add a cluster to an ASM instance.
An ingress gateway is deployed in the ACK cluster that is added to the ASM instance. For more information, see Create an ingress gateway service.
After the ingress gateway is deployed, a service named istio-ingressgateway is automatically created in the ACK cluster.
The Bookinfo application and Istio resources are deployed in the ASM instance so that the Bookinfo application can be accessed by using the ingress gateway. For more information, see Deploy an application in an ASM instance and Use Istio resources to route traffic to different versions of a service.
Procedure
You need to create an additional SLB instance for the ASM gateway by creating a service with which the SLB instance is associated.
If you delete the service associated with the SLB instance, the SLB instance is also deleted.
- Log on to the ACK console.
- In the left-side navigation pane of the ACK console, click Clusters.
- On the Clusters page, find the cluster that you want to manage and click the name of the cluster or click Details in the Actions column. The details page of the cluster appears.
- In the left-side navigation pane of the details page, choose
In the upper part of the Services page, set the Namespace parameter to istio-system and click Create Resources in YAML in the upper-right corner.
On the Create page, select Custom from the Sample Template drop-down list, enter the following content in the Template field, and then click Create.
ImportantThe value of the nodePort parameter cannot be the same as an existing port number.
apiVersion: v1 kind: Service metadata: annotations: service.beta.kubernetes.io/alibaba-cloud-loadbalancer-spec: slb.s1.small service.beta.kubernetes.io/alicloud-loadbalancer-address-type: internet labels: app: istio-ingressgateway asm-system: 'true' istio: ingressgateway name: istio-ingressgateway-2 namespace: istio-system spec: externalTrafficPolicy: Cluster ports: - name: http-0 nodePort: 30544 port: 80 protocol: TCP targetPort: 80 - name: https-2 nodePort: 30682 port: 443 protocol: TCP targetPort: 443 selector: app: istio-ingressgateway asm-system: 'true' istio: ingressgateway provider: asm sessionAffinity: None type: LoadBalancer
name: the name of the service to be created. In this example, the value is set to istio-ingressgateway-2.
service.beta.kubernetes.io/alibaba-cloud-loadbalancer-spec: the specifications of the SLB instance. Valid values: slb.s1.small, slb.s2.small, slb.s2.medium, slb.s3.small, slb.s3.medium, and slb.s3.large.
service.beta.kubernetes.io/alicloud-loadbalancer-address-type: the network type of the SLB instance to be created. Valid values:
internet: an Internet-facing SLB instance
intranet: an internal-facing SLB instance
After the service is created, an SLB instance is automatically created.
Access the ASM gateway by using multiple SLB instances.
Obtain the IP addresses using port 80 of the istio-ingressgateway and istio-ingressgateway-2 services in the External Endpoint column on the Services page.
Enter http://<IP address of the istio-ingressgateway service>/productpage and http://<IP address of the istio-ingressgateway-2 service}>/productpage in the address bar of the browser.
If the page of the Bookinfo application appears after you enter each of the URLs, the preceding configurations take effect. In this case, you can access the ASM gateway by using multiple SLB instances.