This topic describes how to monitor applications in an Alibaba Cloud Container Service for Kubernetes (ACK) cluster by using Application Real-Time Monitoring Service (ARMS).

Background information

ARMS is an application performance management (APM) service developed by Alibaba Cloud.

You can use ARMS to monitor Java applications. To monitor a Java application, you only need to attach an ARMS agent to the startup script of the application. You do not need to modify the code of the application. The ARMS agent helps you locate abnormal or slow API operations, view request parameters, detect memory leaks, and discover performance bottlenecks of the system. This improves the efficiency of online troubleshooting. For more information about ARMS, see Application Real-Time Monitoring Service (ARMS).

Features
  • Automatically discovers application topologiesAutomatically discovers application topologies
  • Automatically detects and monitors APIs
  • Captures abnormal transactions and slow transactions, and provides SQL analysis
  • Reports exceptions in Java applications
  • Queries trace-based transaction snapshotsCreates transaction snapshots
  • Provides real-time multidimensional troubleshooting, which includes multidimensional trace queries and abnormal trace queries
  • Integrates PaaS platforms

Prerequisites

Install components

  1. Log on to the Container Service for Kubernetes (ACK) console.
  2. In the left-side navigation pane, choose Marketplace > App Catalog.
  3. On the App Catalog page, click ack-arms-pilot.
  4. On the App Catalog - ack-arms-pilot page, click Create.
    App Catalog - ack-arms-pilot
    In the left-side navigation pane, choose Applications > Deployments. On the page that appears, select the cluster and the namespace. ack-arms-pilot-default-ack-arms-pilot appears in the list. This indicates that the application is created.Deployments

Grant the permission to use ARMS

  1. Log on to the Container Service for Kubernetes console. In the left-side navigation pane, click Clusters. The Clusters page appears.
    Note To grant the permission to use ARMS, log on to the Container Service for Kubernetes console by using your Alibaba Cloud account.
  2. Click the name of the cluster that you want to manage to view the cluster details.
  3. Click the Cluster Resources tab, and then click Worker RAM Role. The RAM roles page in the Resource Access Management (RAM) console appears.
    Worker RAM Role
    Note

    The new version of the RAM console is used in this topic.

    If you use an earlier version of the RAM console, use one of the following methods:

    Method 1

    1. In the left-side navigation pane, click RAM Roles. In the RAM Role Name field, enter the name of Worker RAM Role and click Search. Click the RAM role name in the search result.Manage roles
    2. In the Basic information section, click Edit Basic Information in the upper-right corner.Basic Information

    Method 2

    In the lower-right corner of the page, click New Version to go to the new version of the RAM console. In the Container Service for Kubernetes console, click Worker RAM Role to log on to the RAM console.Worker RAM Role
  4. On the RAM Roles page, click the RAM role name that you want to view. On the Permissions tab, click the policy name to view the policy details.
  5. On the Policies page, click Modify Policy Document on the Policy Document tab.
    Modify Policy Document
  6. Add the following fields to the Policy Document section and click OK.
    {
        "Action": "arms:*",
        "Resource": "*",
        "Effect": "Allow"
    }
    Policy Document

Deploy ARMS

In the YAML file that is used to create the deployment, add the following annotations to deploy ARMS.
annotations:
  armsPilotAutoEnable: "on"
  armsPilotCreateAppName: "<your-deployment-name>"
Note
  • In the YAML file, add annotations under metadata of template in the spec field.
  • The value of armsPilotCreateAppName is the name of the application that is monitored by ARMS.
  1. In the left-side navigation pane, click Clusters.
  2. On the Clusters page, click the name of a cluster or click Details in the Actions column. The details page of the cluster appears.
  3. In the left-side navigation pane, click Workload.
  4. Click Create from Template in the upper-right corner of the page.
  5. On the Deployments tab, select Custom from the Sample Template drop-down list. Use the following YAML file to modify the deployment, and then click Add Deployment.
    apiVersion: apps/v1 
    kind: Deployment
    metadata:
      name: arms-springboot-demo
      labels:
        app: arms-springboot-demo
    spec:
      replicas: 2
      selector:
        matchLabels:
          app: arms-springboot-demo
      template:
        metadata:
          annotations:
            armsPilotAutoEnable: "on"
            armsPilotCreateAppName: "arms-k8s-demo"
          labels:
            app: arms-springboot-demo
        spec:
          containers:
            - resources:
                limits:
                  cpu: 0.5
              image: registry.cn-hangzhou.aliyuncs.com/arms-docker-repo/arms-springboot-demo:v0.1
              imagePullPolicy: Always
              name: arms-springboot-demo
              env:
                - name: MYSQL_SERVICE_HOST
                  value: "arms-demo-mysql"
                - name: MYSQL_SERVICE_PORT
                  value: "3306"
    ---
    apiVersion: apps/v1 
    kind: Deployment
    metadata:
      name: arms-demo-mysql
      labels:
        app: mysql
    spec:
      replicas: 1
      selector:
        matchLabels:
          app: mysql
      template:
        metadata:
          labels:
            app: mysql
        spec:
          containers:
            - resources:
                limits:
                  cpu: 0.5
              image: registry.cn-hangzhou.aliyuncs.com/arms-docker-repo/arms-demo-mysql:v0.1
              name: mysql
              ports:
                - containerPort: 3306
                  name: mysql
    ---
    apiVersion: v1
    kind: Service
    metadata:
      labels:
        name: mysql
      name: arms-demo-mysql
    spec:
      ports:
        # the port that this service should serve on
        - name: arms-mysql-svc
          port: 3306
          targetPort: 3306
      # label keys and values that must match in order to receive traffic for this service
      selector:
        app: mysql
    ---
  1. On the Deployments tab, you can view the new deployment.
  2. Click ARMS console in the Actions column. Log on to the ARMS console to view application details such as Application Health Overview and API Operations.
    Note If ARMS console does not appear in the Actions column, check whether you have granted Container Service for Kubernetes the permission to use ARMS.
    ARMS console