Prometheus is an open source tool that is used to monitor cloud-native applications. This topic shows you how to deploy a self-managed Prometheus instance to monitor Service Mesh (ASM) instances.
Prerequisites
An ACK cluster is created. For more information, see Create an ACK managed cluster.
An ASM instance is created. For more information, see Create an ASM instance.
A Prometheus instance and a Grafana instance are deployed in the ACK cluster. For more information, see Use open source Prometheus to monitor an ACK cluster.
Step 1: Configure metrics
Log on to the ACK console. In the left-side navigation pane, click Clusters.
On the Clusters page, click the name of the cluster that you want to manage and choose in the left-side navigation pane.
On the Helm page, find ack-prometheus-operator and click Update in the Actions column.
In the Update Release panel, modify the
additionalScrapeConfigs
field in the YAML code editor and click OK.The YAML file is large. You can press the Ctrl+F keyboard shortcut and then search for the
additionalScrapeConfigs
field. The following code shows the modifiedadditionalScrapeConfigs
field.additionalScrapeConfigs: # Scrape config for envoy stats - job_name: 'envoy-stats' metrics_path: /stats/prometheus kubernetes_sd_configs: - role: pod relabel_configs: - source_labels: [__meta_kubernetes_pod_container_port_name] action: keep regex: '.*-envoy-prom' - source_labels: [__address__, __meta_kubernetes_pod_annotation_prometheus_io_port] action: replace regex: ([^:]+)(?::\d+)?;(\d+) replacement: $1:15090 target_label: __address__ - action: labeldrop regex: __meta_kubernetes_pod_label_(.+) - source_labels: [__meta_kubernetes_namespace] action: replace target_label: namespace - source_labels: [__meta_kubernetes_pod_name] action: replace target_label: pod_name
Step 2: Enable Prometheus
For more information, see Collect metrics to Managed Service for Prometheus.
Step 3: Generate monitoring data
Send requests to services on the data plane. In this example, the Bookinfo application is used. For more information, see Getting started. Go to the Productpage page of Bookinfo. Refresh the page multiple times.
Verify the result
Check whether Envoy proxies collect the specified metrics
Run the following command and check the command output. Data in the command output indicates the metric data that is collected by Envoy proxies. If the command output contains no data, Envoy proxies do not collect metric data.
details=$(kubectl get pod -l app=details -o jsonpath={.items..metadata.name})
kubectl exec $details -c istio-proxy -- curl -s localhost:15090/stats/prometheus |grep istio
View the metrics that are monitored by Prometheus
Log on to the ACK console. In the left-side navigation pane, click Clusters.
On the Clusters page, click the name of the cluster that you want to manage and choose in the left-side navigation pane.
On the Services page, click the public endpoint of Prometheus in the External IP column.
On the Prometheus page, enter istio_requests_total in the search box and click Execute. The metrics that are monitored by Prometheus are displayed.
View the Grafana dashboard of the metric data
Log on to the ACK console. In the left-side navigation pane, click Clusters.
On the Clusters page, click the name of the cluster that you want to manage and choose in the left-side navigation pane.
On the Services page, click the public endpoint of Grafana in the External IP column.
On the Grafana page, select Istio Workload Dashboard in the upper-left corner. The following figure shows the Grafana dashboard that is displayed.