You can use Application Real-Time Monitoring Service (ARMS) Application Monitoring to monitor the topologies, API requests, abnormal transactions, slow transactions, and SQL analysis of applications in Container Service for Kubernetes (ACK) Serverless clusters. This topic describes how to enable ARMS Application Monitoring for ACK Serverless clusters. After you enable this feature, you can use ARMS to monitor applications that run on elastic container instances.
Background information
ARMS is an Application Performance Management (APM) service that contains modules such as Application Monitoring and Prometheus Service. ARMS can help you perform full-stack performance monitoring and full-trace analysis to simplify application O&M.
After you install the ARMS agent in an ACK Serverless cluster, ARMS can comprehensively monitor the applications in the cluster. The ARMS agent helps you identify abnormal and slow API operations, view request parameters, and detect system bottlenecks. This improves the efficiency of online diagnostics. For more information about Application Monitoring, see Overview.
Prerequisites
An ACK Serverless cluster is created.
ARMS is activated. For more information, see Activate ARMS.
The version of the Java Development Kit (JDK) is supported by ARMS Application Monitoring. ARMS Application Monitoring supports the following JDK versions:
JDK 1.7.0 and later
JDK 1.8.0_25 and later
NoteIf the JDK version is 1.8.0_25 or 1.8.0_31, the ARMS agent may fail to be installed. In this case, update the JDK version to 1.8.0_191 or later.
JDK 11.0.8 and later
NoteThe ARMS agent installation packages for JDK 1.8 and earlier are different from the ARMS agent installation package for JDK 11. You need to download an agent installation package based on the JDK version or adjust the configurations of the ARMS agent ack-onepilot.
Step 1: Install the ARMS agent
Log on to the ACK console.
On the Clusters page, find the cluster that you want to manage and click the cluster name. The details page of the cluster appears.
Install the ack-onepilot component in the cluster.
In the left-side navigation pane of the details page, choose Operations > Add-ons.
Click the Logs and Monitoring tab, find the ack-onepilot card, and then click Install.
In the dialog box that appears, enter the component configuration information as prompted and click OK.
After the installation is complete, Installed appears in the upper right corner of the ack-onepilot card.
Step 2: Grant the cluster the permissions to access ARMS
Go to the Cloud Resource Access Authorization page to grant the cluster the permissions to access ARMS.
Restart all pods in the ack-onepilot agent.
On the Clusters page of the ACK console, click the name of the cluster to go to the cluster management page.
In the left-side navigation pane, choose Workloads > Deployments.
Redeploy all Deployments that reside in the ack-onepilot namespace.
After the redeployment is complete, in the left-side navigation pane of the Cluster Information page, choose Workloads > Pods. On the Pods page, check whether all pods that reside in the ack-onepilot namespace are in the Running state.
Step 3: Enable Application Monitoring for the application
In the left-side navigation pane of the cluster management page, choose Workloads > Deployments, or choose Workloads > StatefulSets.
Create a new application or update an existing application based on your requirements.
Add labels to the pods in the YAML configuration file of the application to enable Application Monitoring. The following code describes the labels:
labels: armsPilotAutoEnable: "on" # Enable Application Monitoring. armsPilotCreateAppName: "<deployment-name>" # Replace <deployment-name> by using your application name. one-agent.jdk.version: "OpenJDK11" # If the application uses JDK 11, you must configure this parameter. armsSecAutoEnable: "on" # If you want to connect the application to Application Security, you must configure this parameter.
NoteAdd labels to the metadata field of the pods. For example, when you configure a Deployment, add labels in the spec.template.metadata field.
If you enable Application Monitoring for an existing application, restart the application after you update the labels.
The following sample YAML file shows how to create a Java application and enable ARMS Application Monitoring for the application.
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 armsPilotAutoEnable: "on" armsPilotCreateAppName: "arms-springboot-demo" one-agent.jdk.version: "OpenJDK11" 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 # for versions before 1.8.0 use apps/v1beta1 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 armsPilotAutoEnable: "on" armsPilotCreateAppName: "arms-springboot-demo-subcomponent" one-agent.jdk.version: "OpenJDK11" 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 ---
Step 4: View the monitoring data of the application
After ARMS Application Monitoring is enabled for the application, you can view data on the Application Monitoring page in the ARMS console.
In the left-side navigation pane of the cluster management page, choose Workloads > Deployments, or choose Workloads > StatefulSets.
Find the application whose monitoring data you want to view, and click ARMS Console in the Actions column.
View monitoring data of the application.
ARMS Application Monitoring can discover application topologies, capture abnormal and slow transactions, and diagnose performance in a real-time manner. For more information about how to use ARMS Application Monitoring, see Application overview.