Install the ack-onepilot component to monitor Java applications in Container Service for Kubernetes ACK or Container Compute Service ACS, and then view application topology, API calls, abnormal transactions, and slow transactions.
The installation steps for ACK and ACS are identical. This guide uses ACK as the example.
ack-onepilot component
The ack-onepilot component automatically prepares Application Monitoring agent packages for different languages and configures the reporting environment within containers. For more information, see How the ack-onepilot component works.
When an application restarts, ack-onepilot automatically upgrades the agent to the latest version. To pin a specific agent version, see Control the agent version.
Step 1: Install the agent helper (ack-onepilot)
Log on to the ACK console. On the Clusters page, click the name of the cluster.
In the left-side navigation pane, click Add-ons. Then, find ack-onepilot.
ImportantThe ack-onepilot component must be version 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.
If you install ack-onepilot in an ACS cluster, configure accessKey and accessKeySecret at the bottom of the installation card. Use the AccessKey ID and AccessKey secret of your Alibaba Cloud account. For information about how to obtain them, see Create an AccessKey. Make sure that the Alibaba Cloud account has the AliyunARMSFullAccess and AliyunSTSAssumeRoleAccess permissions.
On the page that appears, you can configure the parameters. We recommend that you use the default values. Click OK.
NoteAfter you install ack-onepilot, you can upgrade, configure, or uninstall it on the Add-ons page.
Step 2: Grant permissions to access ARMS resources
ACK managed cluster
If your ACK managed cluster lacks an ARMS addon token, follow these steps to grant the required permissions. If an ARMS addon token already exists, skip 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.
Dedicated cluster/registered cluster
To monitor applications in an ACK dedicated cluster or an ACK One registered cluster, make sure the associated Alibaba Cloud account has the AliyunARMSFullAccess and AliyunSTSAssumeRoleAccess permissions. For more information, see Manage RAM user permissions.
After installing ack-onepilot, configure it with the AccessKey ID and AccessKey secret of an Alibaba Cloud account that has ARMS permissions.
Method 1: Enter AccessKey pair in Helm
-
Log on to the ACK console. In the left navigation pane, click Clusters.
On the Clusters page, click the name of the target cluster. In the left-side navigation pane, choose . Find the ack-onepilot component and click Update.
Replace the placeholders for
accessKeyandaccessKeySecretwith your AccessKey pair, and then click OK.NoteFor information about how to obtain an AccessKey pair, see Create an AccessKey.
In the YAML editor, find
accessKey: __ACCESSKEY__andaccessKeySecret: __ACCESSKEY_SECRET__in thecontrollersection and replace the placeholders with your actual AccessKey information.Restart the application Deployment.
Method 2: Import AccessKey pair via Kubernetes secret
Log on to the Container Service for Kubernetes console, and in the left navigation bar, select Clusters.
On the Clusters page, click the name of the target cluster. In the left-side navigation pane, choose .
Select the ack-onepilot namespace and create a secret containing your AccessKey pair.
NoteFor information about how to obtain an AccessKey pair, see Create an AccessKey.
Set the Secret Name to
ack-onepilot-akskand the Type to Opaque. In the Data section, add two entries: set the keys toakandsk, and enter the corresponding AccessKey ID and AccessKey secret as their values. Then, click OK.In the left-side navigation pane, choose . Click the ack-onepilot component (usually named ack-onepilot-ack-onepilot in the ack-onepilot namespace).
On the ack-onepilot-ack-onepilot page, click Edit in the upper-right corner. In the Environment Variables section, add
ONE_PILOT_ACCESSKEYandONE_PILOT_ACCESSKEY_SECRET, and configure them to reference the values stored in the secret. Then, click OK.Select the secret ack-onepilot-aksk. For the ONE_PILOT_ACCESSKEY variable, select the key ak. For the ONE_PILOT_ACCESSKEY_SECRET variable, select the key sk.
ASK/ECI cluster
To monitor applications in an ACK Serverless cluster (ASK) or a cluster that uses ECI, complete the authorization on the Cloud Resource Access Authorization page, and then restart all pods of the ack-onepilot component.
Step 3: Enable Application Monitoring for Java applications
The following YAML example shows how to create a Deployment with Application Monitoring enabled:
-
Log on to the ACK console. In the left navigation pane, click Clusters.
-
On the Clusters page, click the name of your cluster. In the left navigation pane, click .
On the Stateless page, click
> YAML Edit next to the target application. To create an application, click Create from YAML.In the YAML file, add the following
labelsto thespec.template.metadatasection.labels: armsPilotAutoEnable: "on" armsPilotCreateAppName: "deployment-name" # Replace deployment-name with the name of your application. armsPilotAppWorkspace: "workspace" # Replace with the name of your workspace. aliyun.com/app-language: javaapiVersion: 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 armsPilotAutoEnable: "on" armsPilotCreateAppName: "arms-k8s-demo" armsPilotAppWorkspace: "workspace" spec: containers: - resources: limits: cpu: 0.5 image: registry.cn-hangzhou.aliyuncs.com/arms-docker-repo/arms-springboot-demo:v0.1Click 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, find your application and click its Application Name to view detailed monitoring data.