All Products
Search
Document Center

Application Real-Time Monitoring Service:Monitor a Java application deployed in an ACK cluster

Last Updated:Jun 18, 2025

This topic will walk you through the process for using the Application Monitoring sub-service of Application Real-Time Monitoring Service (ARMS) to monitor a Java application deployed in an Alibaba Cloud Container Service for Kubernetes (ACK) cluster. You can analyze application performance and traces, and configure alerting for the application.

Note

For information about how to monitor Java applications deployed in other environments, see Application monitoring.

Workflow

  1. Install an ARMS agent for the application.

    1. Install the ack-onepilot component (ack-onepilot): The ack-onepilot component is provided by ACK to connect Java or Go applications deployed in ACK clusters to ARMS.

    2. Update the YAML file: You can add labels to the YAML file of the application to enable monitoring through ARMS and configure the application name shown in ARMS.

  2. View monitoring data.

  3. Configure alerting.

Prerequisites

  • ACK:

    • An ACK dedicated cluster, an ACK managed cluster, or a registered cluster is created. For more information, see Create an ACK managed cluster.

    • A Java application is created. Notes:

      If you do not have a Java application, you can use the following YAML template to create one. For more information, see Create a stateless application by using a Deployment.

      Note

      The YAML template creates the following resources:

      • Namespace: arms-demo. All of the following resources are created in the arms-demo namespace.

      • Deployments: arms-springboot-demo and arms-springboot-demo-subcomponent.

      • Service: arms-demo-component.

      • Database: arms-demo-mysql.

      Show the complete YAML file

      apiVersion: v1
      kind: Namespace
      metadata:
        name: arms-demo
      ---
      apiVersion: apps/v1 # for versions before 1.8.0 use apps/v1beta1
      kind: Deployment
      metadata:
        name: arms-springboot-demo
        namespace: arms-demo
        labels:
          app: arms-springboot-demo
      spec:
        replicas: 2
        selector:
          matchLabels:
            app: arms-springboot-demo
        template:
          metadata:
            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: SELF_INVOKE_SWITCH
                    value: "true"
                  - name: COMPONENT_HOST
                    value: "arms-demo-component"
                  - name: COMPONENT_PORT
                    value: "6666"
                  - name: MYSQL_SERVICE_HOST
                    value: "arms-demo-mysql"
                  - name: MYSQL_SERVICE_PORT
                    value: "3306"
      ---
      apiVersion: apps/v1 
      kind: Deployment
      metadata:
        name: arms-springboot-demo-subcomponent
        namespace: arms-demo
        labels:
          app: arms-springboot-demo-subcomponent
      spec:
        replicas: 2
        selector:
          matchLabels:
            app: arms-springboot-demo-subcomponent
        template:
          metadata:
            labels:
              app: arms-springboot-demo-subcomponent
          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-subcomponent
                env:
                  - name: SELF_INVOKE_SWITCH
                    value: "false"
                  - name: MYSQL_SERVICE_HOST
                    value: "arms-demo-mysql"
                  - name: MYSQL_SERVICE_PORT
                    value: "3306"
      ---
      apiVersion: v1
      kind: Service
      metadata:
        labels:
          name: arms-demo-component
        name: arms-demo-component
        namespace: arms-demo
      spec:
        ports:
          # the port that this service should serve on
          - name: arms-demo-component-svc
            port: 6666
            targetPort: 8888
        # label keys and values that must match in order to receive traffic for this service
        selector:
          app: arms-springboot-demo-subcomponent
      ---
      apiVersion: apps/v1 # for versions before 1.8.0 use apps/v1beta1
      kind: Deployment
      metadata:
        name: arms-demo-mysql
        namespace: arms-demo
        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
        namespace: arms-demo
      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
      ---
  • ARMS:

    Application Monitoring is activated, and the pay-by-observable-data billing mode is enabled.

    Application Monitoring provides a free monthly quota of 50 GB. The quota of a month cannot be used after the end of the month. If the quota is used up, you are charged based on the excess observable data. For more information, see Billing.

Install an ARMS agent

Step 1: Install the ack-onepilot component

  1. Log on to the ACK console. On the Clusters page, click the name of the cluster.

  2. In the left-side navigation pane, click Add-ons. On the Add-ons page, search for ack-onepilot.

  3. In the ack-onepilot section, click Install. In the dialog box that appears, click OK.

    image

Step 2: Update the YAML file

  1. In the left-side navigation pane, choose Workloads > Deployments. On the page that appears, select the namespace where the Deployments reside. Find a Deployment and choose image > Edit YAML in the Actions column.

  2. In the Edit YAML dialog box, add the following labels to the spec.template.metadata parameter and click Update.

    labels:
      armsPilotAutoEnable: "on"
      armsPilotCreateAppName: "<your-deployment-name>"    # Specify the display name of the Deployment in ARMS.

    For example, you can modify the YAML files of the arms-springboot-demo and arms-springboot-demo-subcomponent Deployments, enable ARMS monitoring for the Deployments, and set arms-k8s-demo and arms-k8s-demo-subcomponent as their names shown in ARMS.

    arms-springboot-demo Deployment

    image

    arms-springboot-demo-subcomponent Deployment

    image

  3. After the Deployments are automatically redeployed, wait for 1 to 2 minutes. In the left-side navigation pane of the ARMS console, choose Application Monitoring > Application List. On the page that appears, click the name of each Deployment to view the metrics. For more information, see View monitoring details (new).

    image

View the monitoring details

Trace Explorer

Trace Explorer allows you to combine filter conditions and aggregation dimensions for real-time analysis. You can troubleshoot failed or slow calls of your application based on the failed or slow trace data.

arms-k8s-demo application

image

Trace details

image

arms-k8s-demo-subcomponent application

image

Trace details

image

Metrics

  • Application overview

    arms-k8s-demo application

    image

    arms-k8s-demo-subcomponent application

    image

  • Topology

    arms-k8s-demo application

    image

    arms-k8s-demo-subcomponent application

    image

Configure alerting

You can configure alerting for the application. If an alert is triggered, alert notifications are sent to the contacts or DingTalk group chat based on the specified notification methods. For more information, see Alert rules.

image

Release resources

You can perform the following operations after you complete the whole process:

  • If you still want to monitor the application, make sure that your Alibaba Cloud account does not have overdue payments.

  • If you no longer want to monitor the application, uninstall the ARMS agent. For more information, see Uninstall an ARMS agent for Java.

References

  • ARMS provides various trace sampling modes. You can select an appropriate mode based on your scenarios so that you can obtain the trace data that you want at a low cost. For more information, see Select a trace sampling mode for the ARMS agent V3.2.8 and later.

  • Application Monitoring allows you to associate trace IDs with the business logs of an application. This way, when an error occurs in your application, you can access the business logs associated with trace IDs to troubleshoot the error. For more information, see Associate trace IDs with logs for a Java application.

  • If your application in a production environment has high CPU utilization or memory usage, or a large number of slow calls, you can use the flame graph generated by the continuous profiling feature to locate the root causes. For more information, see Continuous profiling for Java applications.

  • Alibaba Cloud Managed Service for Prometheus integrates with the Application Monitoring data source to visualize metrics. You can obtain application monitoring data, view preset dashboards, and perform secondary development based on your business requirements in Managed Service for Prometheus. For more information, see Use Managed Service for Prometheus to obtain application monitoring data.