You can install the ack-onepilot component to monitor Java applications deployed in Container Service for Kubernetes (ACK) or Container Compute Service (ACS). After the component is installed, you can view monitoring data such as application topology, API calls, and abnormal or slow transactions. This topic describes how to install an agent for Java applications in Container Service for Kubernetes (ACK) and Container Compute Service (ACS).
About the ack-onepilot component
The Application Monitoring agent installation assistant, ack-onepilot, is a key component for installing agents for different languages. It automatically prepares the Application Monitoring agent package and configures the agent's reporting environment within a container. For more information about the basic principles of ack-onepilot, see Basic principles of the ack-onepilot component.
After the agent is installed, ack-onepilot automatically upgrades the agent to the latest version when the application is restarted and a new version of the agent is available. If you do not want the agent to be automatically updated with each new release, you can control the agent version. For more information, see Control the agent version.
Step 1: Install the agent installation assistant (ack-onepilot)
Log on to the ACK console. On the Clusters page, click the name of the cluster.
In the navigation pane on the left, click Add-ons. Then, find ack-onepilot.
ImportantThe ack-onepilot version must be 5.1.0 or later.
Click Install on the ack-onepilot card.
NoteBy default, the ack-onepilot component supports 1,000 pods. For every additional 1,000 pods in the cluster, you must add 0.5 CPU cores and 512 MB memory for the component.
In the dialog box that appears, configure the parameters and click OK. We recommend that you use the default values.
NoteAfter you install ack-onepilot, you can upgrade, configure, or uninstall it on the Add-ons page.
Step 2: Grant access permissions on ARMS resources
ACK managed cluster
If ARMS Addon Token does not exist in your ACK managed cluster, perform the following steps to authorize the cluster to access ARMS. If ARMS Addon Token exists, go to Step 3.
If a cluster has ARMS Addon Token, ARMS performs password-free authorization on the cluster. ARMS Addon Token may not exist in some ACK managed clusters. We recommend that you check whether an ACK managed cluster has ARMS Addon Token before you use ARMS to monitor applications in the cluster. If the cluster has no ARMS Addon Token, you must authorize the cluster to access ARMS.
ACK dedicated cluster/registered cluster
To monitor an application deployed in an ACK dedicated cluster or registered cluster, make sure that the AliyunARMSFullAccess and AliyunSTSAssumeRoleAccess permissions are granted to your Resouce Access Management (RAM) user.
After installing the ack-onepilot component, enter the AccessKey ID and AccessKey Secret of the account in the configuration file of ack-onepilot.
Method 1: Input in Hem
Log on to the ACK console. In the left navigation pane, click Clusters.
On the Clusters page, click the cluster you want to manage. In the left-side navigation pane of the page that appears, choose . Then, click Update next to ack-onepilot.
Replace
accessKeyandaccessKeySecretwith the AccessKey ID and AccessKey secret of the account and click OK.NoteThe AccessKey Secret is only visible during initial creation of an Alibaba Cloud AccessKey pair and cannot be retrieved afterward. This design mitigates leakage risks. Securely store the Secret immediately.

Restart the Deployment.
Method 2: Import through Kubernetes Secrets
Log on to the ACK console. In the left-side navigation pane, click Clusters.
On the Clusters page, click the cluster you want to manage. In the left-side navigation pane of the page that appears, choose .
Click Create. In the panel that appears, click Add and add the AccessKey ID and AccessKey Secret for ack-onepilot.
NoteThe AccessKey Secret is only visible during initial creation of an Alibaba Cloud AccessKey pair and cannot be retrieved afterward. This design mitigates leakage risks. Securely store the Secret immediately.

In the left-side navigation pane, choose . On the page that appears, click the ack-onepilot component. Generally, it is named ack-onepilot-ack-onepilot in the ack-onepilot namespace.
In the upper-right corner of the page that appears, click Edit.
Scroll down until you see the Environments section. Click Add, add the environment variables
ONE_PILOT_ACCESSKEYandONE_PILOT_ACCESSKEY_SECRET, reference the Secrets in Kubernetes Secrets, and click OK.
ASK/ECI cluster
To monitor applications in an ACK Serverless (ASK) cluster or applications in a Kubernetes cluster connected to Elastic Container Instance, you must first authorize the cluster to access ARMS on the Cloud Resource Access Authorization page. Then, restart all pods on which the ack-onepilot component is deployed.
Step 3: Enable Application Monitoring for a Java application
The following YAML template shows how to create a deployment and enable Application Monitoring for it:
Log on to the ACK console. In the left navigation pane, click Clusters.
On the Clusters page, find the cluster you want to manage and click its name. In the left navigation pane, choose .
On the Deployments page, choose in the Actions column.
In the YAML file, add the following
labelsto the `spec.template.metadata` section.labels: armsPilotAutoEnable: "on" armsPilotCreateAppName: "deployment-name" # Replace deployment-name with the name of your application. armsPilotAppWorkspace: "workspace" # Replace workspace with the name of your workspace.
Click Update.
View monitoring details
Log on to the Cloud Monitor 2.0 console, and select a workspace. In the left navigation pane, choose .
On the Application List page, you can view the connected applications. Click the name of an application to view its detailed monitoring data.
