After serverless Kubernetes (ASK) clusters are connected to Application Real-Time Monitoring Service (ARMS) Prometheus Monitoring, you can use the dashboard predefined in ARMS to monitor multiple performance metrics of the ASK clusters. This topic describes how to connect ASK clusters to ARMS Prometheus Monitoring.
Prerequisites
An ASK cluster is created.
NoteIf the security group in the cluster is manually modified after it is automatically created, make sure that ports 8080, 8081, and 9335 are enabled.
ARMS is activated. For more information, see Activate and upgrade ARMS.
NoteYou can receive a free 15-day trial of the Prometheus Monitoring sub-service of ARMS. After the free trial expires, you must activate the Pro Edition of ARMS Prometheus Monitoring for continual use. For more information, see the Application Real-Time Monitoring Service pricing page.
Background information
ARMS is an Application Performance Management (APM) service that contains modules such as Application Monitoring and Prometheus Monitoring. ARMS can help you perform full-stack performance monitoring and full-trace analysis in an end-to-end manner to simplify application O&M.
ARMS Prometheus Monitoring is a managed monitoring service of ARMS and compatible with the open source Prometheus ecosystem. ARMS Prometheus Monitoring monitors a wide variety of components and provides various ready-to-use predefined dashboards. You no longer need to concern yourself with managing underlying services such as data storage, data presentation, and system O&M. For more information, see What is Prometheus Service?
Install the Prometheus Monitoring agent
Log on to the Container Service - Kubernetes console.
In the left-side navigation pane, choose Marketplace > App Catalog.
On the Alibaba Cloud Apps tab, click the ack-arms-prometheus application.
Configure the parameters and select the cluster for which you want to install the agent.
Select the cluster for which you want to install the agent from the drop-down list.
On the Parameters tab, specify the accessKey and accessKeySecret parameters in the YAML template.
Click Create.
Check the installation result.
Click the cluster name to go to the cluster information page. In the left-side navigation pane, choose Applications > Helm to check whether the status of arms-prom is Deployed.
View ARMS Prometheus Monitoring metrics
After the monitoring agent is installed, you can view the detailed monitoring information on the Prometheus Monitoring page in the ARMS console.
In the left-side navigation pane of the Container Service - Kubernetes console, click Clusters.
Find the cluster whose monitoring data you want to view and click the cluster name.
On the Cluster Information page, click Prometheus Monitoring in the upper-right corner.
View the Prometheus Monitoring metrics.
You can switch between tabs to view the metrics displayed on different boards. For more information, see View Prometheus Monitoring metrics.
In the upper-right corner, click Go to ARMS to redirect to the ARMS console and configure the Prometheus Monitoring dashboard for the cluster.
Configure a data collection rule for Prometheus Monitoring
ARMS Prometheus Monitoring is compatible with and provides three types of mainstream collection rules:
The standard open source collection rule, which can be obtained by editing the prometheus.yaml file.
The collection rule suitable for customizing monitoring within Kubernetes clusters. This rule can be obtained by adding ServiceMonitor.
The default collection rule, which can be obtained by adding annotations.
You can configure the three types of rules by using the following methods:
Edit prometheus.yaml
You do not need to restart Prometheus Monitoring. You can dynamically update a collection rule by editing the prometheus.yaml file.
Log on to the ARMS console and go to the Prometheus Monitoring page. Find the cluster for which you want to configure a collection rule and click Settings.
On the page that appears, click the Prometheus Settings tab.
Edit the Prometheus.yaml file and click Save.
Add ServiceMonitor
After you add ServiceMonitor, you can monitor business data of applications within a Kubernetes cluster.
Log on to the ARMS console and go to the Prometheus Monitoring page. Find the cluster for which you want to configure a collection rule and click Settings.
On the page that appears, click the Service Discovery tab. Click Add ServiceMonitor.
Enter the content by referring to the following example and click OK:
apiVersion: monitoring.coreos.com/v1 kind: ServiceMonitor metadata: # Enter a unique name. name: tomcat-demo # Enter a namespace. namespace: default spec: endpoints: - interval: 30s # Enter the value of the Name field for Port of Prometheus Exporter. port: tomcat-monitor # Enter the value of the Path field for Prometheus Exporter. path: /prometheus-metrics namespaceSelector: any: true selector: matchLabels: # Enter the label field of service.yaml to locate the destination service.yaml file. app: tomcat
Add annotations
In the YAML file of the application, enter the following content to add annotations:
annotations: prometheus.io/scrape: "true" prometheus.io/port: "9090" prometheus.io/path: "/metrics"