You can use Application Real-Time Monitoring Service (ARMS) Application Monitoring to monitor the topologies, API requests, abnormal transactions, slow transactions, and slow SQL queries of applications in serverless Kubernetes (ASK) clusters. This topic describes how to connect ASK clusters to ARMS Application Monitoring.
Prerequisites
An ASK cluster is created.
ARMS is activated. For more information, see Activate and upgrade ARMS.
NoteYou can receive a free 15-day trial of the Application Monitoring sub-service of ARMS. After the free trial expires, you must activate the Basic Edition or Pro Edition of ARMS Application 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.
After you install the ARMS Application Monitoring agent in an ASK cluster, ARMS can perform comprehensive monitoring on the applications deployed in the ASK cluster and help you easily identify abnormal and slow API operations, view request parameters, and detect system bottlenecks. This way, the efficiency of online problem diagnostics can be significantly improved. For more information, see Overview.
Step 1: Install the Application 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-pilot 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-pilot is Deployed.
Step 2: Enable Application Monitoring for applications
You can add annotations to the YAML template of an application to enable Application Monitoring. Add annotations to spec > template > metadata.
annotations:
armsPilotAutoEnable: "on"
armsPilotCreateAppName: "<your-deployment-name>"
Enable Application Monitoring for a new application
In the Container Service - Kubernetes console, find the cluster in which you want to create an application and click the cluster name. On the page that appears, choose Workloads > Deployments in the left-side navigation pane.
In the upper-right corner, click Create from Template.
Select a namespace and a sample template from the drop-down lists, add annotations to spec > template > metadata, and then click Create.
The following example describes a complete YAML template used to enable ARMS Application Monitoring for an application. The Java application Spring Cloud Eureka Server is used in the example.
apiVersion: apps/v1 kind: StatefulSet metadata: name: register-server spec: replicas: 3 serviceName: register-server selector: matchLabels: app: register-server template: metadata: labels: app: register-server annotations: armsPilotAutoEnable: "on" # Enable ARMS Application Monitoring. armsPilotCreateAppName: "register-server" # Specify the name of the application for which to enable ARMS Application Monitoring. spec: containers: - name: register-server image: registry.cn-hangzhou.aliyuncs.com/shuangling/eureka-server:v1 imagePullPolicy: Always env: - name: EUREKA_DEFAULT_ZONE value: "http://register-server-0.register-server:8000/eureka/,http://register-server-1.register-server:8000/eureka/,http://register-server-2.register-server:8000/eureka/" - name: JVM_OPTS value: " -Xms1024m -Xmx1536m " - name: MY_POD_NAME valueFrom: fieldRef: fieldPath: metadata.name ports: - name: http containerPort: 8000 protocol: TCP readinessProbe: httpGet: path: /actuator/health port: 8001 scheme: HTTP failureThreshold: 3 initialDelaySeconds: 60 periodSeconds: 10 successThreshold: 1 timeoutSeconds: 10 volumeMounts: - mountPath: /Charts name: data volumes: - name: data emptyDir: {} podManagementPolicy: "Parallel" --- apiVersion: v1 kind: Service metadata: name: register-server labels: app: register-server spec: clusterIP: None type: ClusterIP ports: - port: 8000 targetPort: http protocol: TCP name: http selector: app: register-server
Enable Application Monitoring for an existing application
In the Container Service - Kubernetes console, find the cluster where the application is deployed and click the cluster name. On the page that appears, choose Workloads > Deployments or Workloads > StatefulSets in the left-side navigation pane.
Find the application for which you want to enable Application Monitoring, click More, and then select View in YAML in the Actions column.
Edit the YAML template by adding annotations to spec > template > metadata.
Click Update.
After the YAML template is updated, the container groups are recreated. This process may take some time. Wait until the rolling update is completed for all container groups before you can view the monitoring data.
Step 3: View monitoring data
After ARMS Application Monitoring is enabled, you can view data on the Application Monitoring page in the ARMS console.
In the Container Service - Kubernetes console, find the cluster where the application is deployed and click the cluster name. On the page that appears, choose Applications > Deployments or Applications > StatefulSets in the left-side navigation pane.
Find the application whose monitoring data you want to view, and click ARMS Console in the Actions column.
View monitoring data of the application.
ARMS Application Monitoring can discover application topologies, capture abnormal and slow transactions, and diagnose performance in a real-time manner. For more information about how to use ARMS Application Monitoring, see Application overview.