After you install ack-onepilot and compile the Go binary file, Application Real-Time Monitoring Service (ARMS) starts to monitor your Go application. You can view the monitoring data, such as the application topology, interface calls, and database analysis data. This topic describes how to install an ARMS agent for a Go application deployed in Container Service for Kubernetes (ACK) or Container Compute Service (ACS).
If you have any questions when you use an ARMS agent, join the DingTalk group chat (ID: 35568145) for technical support.
Prerequisites
An ACK cluster is created. You can create an ACK dedicated cluster, ACK managed cluster, or ACK Serverless cluster based on your business requirements.
A namespace is created in the cluster. For more information, see Manage namespaces and resource quotas. The namespace used in this example is default.
Check the operating system and architecture of the environment, and the versions of Go and frameworks. For more information, see Go components and frameworks supported by ARMS.
A go.mod file is created. Application Monitoring only supports compilation based on a go.mod file. To create a go.mod file, run the go mod init command.
Procedure
The procedure for installing an ARMS agent for an application deployed in ACK is the same as that for an application deployed in ACS. The following uses the ACK environment as an example.
Step 1: Install ack-onepilot
Log on to the ACK console. On the Clusters page, click the name of the cluster that you want to manage.
In the left-side navigation pane, choose
. On the Add-ons page, enter ack-onepilot in the upper-right corner.ImportantMake sure that the ack-onepilot version is 3.2.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 need to 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: Compile the Go binary file
Run the
wget
command to download the compilation tool instgo based on the region where the environment and machine reside.NoteThe compilation tool for Go, instgo, is provided by ARMS to help you monitor your Go applications.
If you are able to access Object Storage Service (OSS) over the Internet, you can directly use the public endpoint of the operating system and architecture in the China (Hangzhou) region to obtain the compilation tool.
Grant the compilation tool the permissions required to perform the related operations.
Linux/Darwin
# Grant the permissions. chmod +x instgo
Windows
In Windows, you do not need to grant permissions.
Optional. Obtain the license key and set the compilation parameter.
ImportantIf you skip this step, instgo enters Dev mode and installs the ARMS agent of the latest version by default. To deploy the agent in a production environment, we recommend that you set the DescribeTraceLicenseKey parameter.
You can call an API operation to obtain the license key. For more information, see DescribeTraceLicenseKey.
After you obtain the license key, run the
set
command to set the compilation parameter.instgo set --licenseKey=${YourLicenseKey} --regionId=${YourRegionId} --dev=false
Add instgo as a prefix to your existing compilation command and run the following command:
instgo go build {arg1} {arg2} {arg3}
Use the binary file compiled in the previous step to build the image.
References
The following table describes the common Instgo commands.
Command
Flag
Parameter type
Description
Required
build
(compilation)--licenseKey, -l
String
The license key.
Yes (except for Dev Mode)
--dev
-
Specifies Dev Mode as the development mode. In this mode, you can compile data to test functionality without specifying the license key.
ImportantSome features are degraded. Do not use Dev Mode in a production environment.
No
--agentVersion
String
Specifies the version of the ARMS agent.
No
--agentPath
String
Specifies the local path of the ARMS agent.
No
--cacheDir
String
Specifies the cache directory of the ARMS agent.
No
--regionId, -r
String
The ID of the region from which the dependencies of the ARMS agent are downloaded. Default value: cn-hangzhou.
No
--timeout, -t
Integer
The timeout period for downloading the dependencies of the ARMS agent. Unit: seconds. Default value: 180.
No
--verbose, -v
-
Specifies whether to print detailed compilation logs.
No
--vpc
-
Specifies whether to download the dependencies of the ARMS agent over a virtual private cloud (VPC).
No
clean
(cleanup)
-
-
-
-
update
(update)--licenseKey, -l
String
The license key.
Yes
--cacheDir
String
Specifies the cache directory of the ARMS agent.
No
--regionId, -r
String
The ID of the region from which the dependencies of the ARMS agent are downloaded. Default value: cn-hangzhou.
No
--timeout, -t
Integer
The timeout period for downloading the dependencies of the ARMS agent. Unit: seconds. Default value: 180.
No
--vpc
Specifies whether to download the dependencies of the ARMS agent over a VPC.
No
version
(version)
-
-
-
-
The first time that you compile the application, the ARMS agent is downloaded to the
/opt
directory (C:\ProgramData
in Windows) by default. If you have no permissions on the directory, you can use the--cacheDir
flag to specify a cache directory or run thesudo -E
command to compile the agent. In Windows, run commands to compile the application as an administrator.If the compilation is forcibly stopped or killed, a residue may be caused. For information about how to clean up the residue, see Uninstall an ARMS agent for Go.
Step 3: Grant access permissions on ARMS resources
To monitor applications in a serverless Kubernetes (ASK) cluster or applications in a Kubernetes cluster connected to Elastic Container Instance (ECI), 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.
To monitor an application deployed in an ACK cluster with no ARMS Addon Token, perform the following operations to authorize the ACK cluster to access ARMS. If ARMS Addon Token exists, go to Step 4.
NoteIf 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 manually authorize the cluster to access ARMS.
To monitor an application deployed in an ACK dedicated cluster or registered cluster, make sure that the AliyunARMSFullAccess and AliyunSTSAssumeRoleAccess permissions are granted to the RAM user. For more information about how to grant permissions to a RAM user, see Grant permissions to a RAM user.
After you install ack-onepilot, you must enter the AccessKey ID and AccessKey secret of the Alibaba Cloud account in the configuration file of ack-onepilot.
In the left-side navigation pane, choose
. Then, click Update next to ack-onepilot.Replace
accessKey
andaccessKeySecret
with the AccessKey ID and AccessKey secret of the Alibaba Cloud account and click OK.NoteFor more information about how to obtain an AccessKey pair, see Create an AccessKey.
Restart the Deployment.
Step 4: Enable Application Monitoring for the application
Log on to the ACK console. In the left-side navigation pane, click Clusters.
On the Clusters page, find the cluster that you want to manage and click its name. In the left-side pane, choose .
On the Deployments page, find the application and choose
in the Actions column.To enable Application Monitoring for a new Go application, click Create from YAML on the Deployments page.
Add the following tags to
spec.template.metadata
:labels: aliyun.com/app-language: golang # Specify a Go application. armsPilotAutoEnable: 'on' armsPilotCreateAppName: "<your-deployment-name>" # Replace <your-deployment-name> with the Deployment name.
The following YAML template shows how to create a Deployment and enable Application Monitoring for the application:
Verify the result
After about one minute, log on to the ARMS console. In the left-side navigation pane, choose . If the application is displayed on the Application List page, the application is being monitored.