All Products
Search
Document Center

Alibaba Cloud Service Mesh:Customize a scaling policy for an ASM gateway

Last Updated:Oct 22, 2024

A Service Mesh (ASM) gateway allows you to configure the number of replicas and HPA-related parameters in the YAML file of the gateway. HPA is short for horizontal pod autoscaling. This configuration method can meet the requirements in most scenarios. However, in some extreme cases, the number of replicas and the HPA-related parameter settings cannot meet requirements. For example, when a service has regular peak hours and off-peak hours, it is more suitable to use CronHPA to adjust the number of replicas. To meet such requirements, ASM supports custom scaling policies for gateways.

Usage notes

After you create an ASM gateway, the control plane automatically creates a Deployment named istio-${Name of the ASM gateway} in the istio-system namespace of the cluster on the data plane. This Deployment is managed by ASM. Any modification to its parameters is invalid. ASM automatically resynchronizes data and overwrites custom configurations to ensure the normal operation of the gateway.

To support custom scaling of gateways, ASM instances of V1.19 and later allow you to configure the annotation asm.alibabacloud.com/replicas-managed-by-asm: false. After you add this annotation to the gateway definition, the ASM control plane skips the synchronization of the number of replicas each time the gateway Deployment is synchronized. This way, you can modify the number of replicas of the gateway Deployment based on your business requirements, and the modification will not be overwritten by the control plane.

Sample gateway YAML file:

apiVersion: istio.alibabacloud.com/v1beta1
kind: IstioGateway
metadata:   
  name: "ingressgateway"  
  namespace: "istio-system"
  annotations:
    asm.alibabacloud.com/replicas-managed-by-asm: false # ASM does not synchronize the number of replicas of the gateway Deployment.
spec:  
  ......
  ports:  
  - name: http    
    port: 80    
    targetPort: 80
  ......

Related operations

After you add the annotation, you can manually manage the number of replicas of the gateway. You can also use resources such as HPA and CronHPA to automatically manage the scaling policy of the gateway.