The Mixerless Telemetry technology of Alibaba Cloud Service Mesh (ASM) allows you to obtain telemetry data from containers in a non-intrusive manner. Telemetry data is collected by Prometheus Service or self-managed Prometheus as monitoring metrics. You can use the telemetry data to observe ASM instances. This topic describes how to use ASM to obtain application monitoring metrics that are collected by self-managed Prometheus to observe ASM instances.
Prerequisites
- An ASM instance is created. For more information, see Create an ASM instance.
- An ACK managed cluster is created. For more information, see Create an ACK managed cluster.
- The cluster is added to the ASM instance. For more information, see Add a cluster to an ASM instance.
Step 1: Install Prometheus
- Download and decompress the installation package of Istio. To download the installation package of Istio, go to the Download Istio page.
- Use kubectl to connect to the ACK cluster. For more information, see Obtain the kubeconfig file of a cluster and use kubectl to connect to the cluster.
- Run the following command to install Prometheus:
kubectl --kubeconfig <Path of the kubeconfig file> apply -f <Path to which the installation package of Istio is decompressed>/samples/addons/prometheus.yaml
Step 2: Create a service entry
- Log on to the ASM console.
- In the left-side navigation pane, choose .
- On the Mesh Management page, find the ASM instance that you want to configure. Click the name of the ASM instance or click Manage in the Actions column.
- On the details page of the ASM instance, choose Settings in the upper-right corner. in the left-side navigation pane. On the page that appears, click
- In the Settings Update panel, select Enable Prometheus and then Enable Self-managed Prometheus. In the field that appears, enter a Prometheus endpoint. In this example, the default endpoint http://prometheus:9090 is used. Then, click OK. Note In this example, self-managed Prometheus is used. If you use Prometheus Service, see Monitor service meshes based on ARMS Prometheus.In the left-side navigation pane of the details page, choose. On the page that appears, you can view the created service entry.
Step 3: Configure Prometheus
- Configure the monitoring metrics of Istio.
- 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 ConfigMap page, select istio-system from the Namespace drop-down list. Find the item that is named prometheus and click Edit in the Actions column.
- In the Edit panel, enter configuration information in the Value field and click OK. To obtain the configuration information, visit GitHub.
- Delete the pod of Prometheus to make Prometheus configurations take effect.
- 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 .
- On the Pods page, find the pod that is named Prometheus and click Delete in the Actions column.
- In the Delete Pod message, click Confirm.
- Run the following command to view
job_name
in the Prometheus configurations:kubectl --kubeconfig <Path of the kubeconfig file> get cm prometheus -n istio-system -o jsonpath={.data.prometheus\\.yml} | grep job_name
Expected output:
- job_name: 'istio-mesh' - job_name: 'envoy-stats' - job_name: 'istio-policy' - job_name: 'istio-telemetry' - job_name: 'pilot' - job_name: 'sidecar-injector' - job_name: prometheus job_name: kubernetes-apiservers job_name: kubernetes-nodes job_name: kubernetes-nodes-cadvisor - job_name: kubernetes-service-endpoints - job_name: kubernetes-service-endpoints-slow job_name: prometheus-pushgateway - job_name: kubernetes-services - job_name: kubernetes-pods - job_name: kubernetes-pods-slow
Step 4: Generate monitoring data
- Deploy the podinfo application in the ACK cluster.
- Run the following command to request the podinfo application to generate monitoring data:
podinfo_pod=$(k get po -n test -l app=podinfo -o jsonpath={.items..metadata.name}) for i in {1..10}; do kubectl --kubeconfig "$USER_CONFIG" exec $podinfo_pod -c podinfod -n test -- curl -s podinfo:9898/version echo done
- Check whether monitoring data is generated in the Envoy container.
Verify the result
- Expose Prometheus by using a Server Load Balancer (SLB) instance. For more information, see Use Services to expose applications.
- 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
- On the Services page, find the service that is named Prometheus and click the IP address in the External Endpoint column.
- On the Prometheus page, enter istio_requests_total in the search box and click Execute. The following figure shows that application monitoring metrics are collected by Prometheus.