The adaptive xDS optimization feature analyzes the call dependencies among services in a Service Mesh (ASM) instance based on access logs, and automatically generates sidecars that contain the service-specific configurations. This is more efficient compared with the mechanism where the control plane pushes configurations of all services to the sidecar of each service on the data plane. This topic describes how to use the adaptive xDS optimization feature.
Prerequisites
Traffic is routed to different versions of a service by using Istio resources.
Background information
By default, a sidecar stores information about all services on the data plane because the control plane cannot determine the call dependencies among the services. Each time you modify configurations on the control plane or data plane, the control plane pushes the new configurations to all sidecars on the data plane. For example, if you create a virtual service on the control plane, the control plane pushes information about the virtual service to all sidecars on the data plane.
You can use the adaptive xDS optimization feature to automatically generate sidecars for services. After you enable the feature, an egress gateway named istio-axds-egressgateway is deployed in the Kubernetes cluster and all HTTP traffic is first routed to the egress gateway. The feature automatically analyzes the call dependencies between services in the ASM instance based on the access logs of the egress gateway. For more information about the benefits, see Effects of sidecar recommendation on configuration push optimization.
Limits
The version of the ASM instance must be 1.15.3.63 or later. For more information about how to update an ASM instance, see Update an ASM instance.
The feature applies only to the services that are accessed over HTTP.
Step 1: Enable the adaptive xDS optimization feature
- 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 Adaptive xds optimization page, turn on the Enable adaptive xds optimization switch. In the Submit message that appears, click OK.
Updating is displayed below the switch. Wait until the update is complete. When the update is complete, the Enable adaptive xds optimization switch is turned on and a list of namespaces appears below the switch.
Step 2: Enable the xDS optimization feature for a namespace
After you enable the xDS optimization feature for a namespace, the configuration push is optimized for all services in the namespace, and sidecars that contain service dependencies are automatically generated for the services. You can also add asm.alibabacloud.com/asm-adaptive-xds: true
to the annotations
of a service to enable the feature for the service.
On the details page of the ASM instance, choose in the left-side navigation pane.
On the Adaptive xds optimization page, find the namespace in which your services reside, and turn on the switch in the Status column. In the Submit message that appears, click OK.
On the details page of the ASM instance, choose in the left-side navigation pane.
On the Sidecar page, view the automatically-created sidecars.
All sidecars that are automatically created are displayed on the page, and the sidercar names start with axds. Each sidecar corresponds to a service of the Bookinfo application that is deployed in the ASM instance.
Step 3: Access the application to verify that the feature takes effect
Obtain the IP address of the ingress gateway.
Log on to the ACK console and click Clusters in the left-side navigation pane.
On the Clusters page, click the name of a cluster and choose in the left-side navigation pane.
In the upper part of the Services page, select istio-system from the Namespace drop-down list. Find the ingress gateway that is named istio-ingressgateway and view the IP address whose port is 80 in the External Endpoint column.
The IP address that contains the 80 port is the IP address of the ingress gateway.
Enter http://{IP address of the ingress gateway}/productpage in the address bar of your browser to access the Bookinfo application.
View the sidecar.
- 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 Sidecar page, find the axds-productpage sidecar and click View YAML in the Actions column.
Sample YAML file:
apiVersion: networking.istio.io/v1beta1 kind: Sidecar metadata: annotations: adapted-svc: productpage.default.svc.cluster.local labels: asm-adaptive-xds-system: 'true' asm-system: 'true' provider: asm name: axds-productpage namespace: default spec: egress: - hosts: - default/details.default.svc.cluster.local - default/kubernetes.default.svc.cluster.local - default/reviews.default.svc.cluster.local - istio-system/* - kube-system/* workloadSelector: labels: app: productpage
In the YAML file, the
axds-productpage
sidecar that is automatically generated for theproductpage
service containsdetails
andreviews
services on which theproductpage
service depends.
Related operations
Disable the adaptive xDS optimization feature
- 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 Adaptive xds optimization page, turn off the Enable adaptive xds optimization switch. In the Submit message that appears, click OK.
Updating is displayed below the switch. Wait until the update is complete. When the update is complete, the Enable adaptive xds optimization switch is turned off.
On the details page of the ASM instance, choose in the left-side navigation pane.
The sidecars that were created by using the xDS optimization feature are deleted.