You can use Application Real-Time Monitoring Service (ARMS) to monitor the status of applications in real time. To monitor applications in a registered cluster, you need to install the ARMS application monitoring component in the registered cluster.
Prerequisites
An external Kubernetes cluster is registered in the Container Service for Kubernetes (ACK) console. For more information, see Create a registered cluster and register an external cluster with ACK.
A kubectl client is connected to the registered cluster. For more information, see Obtain the kubeconfig file of a cluster and use kubectl to connect to the cluster.
Step 1: Install the ARMS application monitoring component
Use onectl
Install onectl on your on-premises machine. For more information, see Use onectl to manage registered clusters.
Run the following command to configure RAM permissions for the ack-onepilot component:
onectl ram-user grant --addon ack-onepilot
Expected output:
Ram policy ack-one-registered-cluster-policy-ack-onepilot granted to ram user **** successfully.
Run the following command to install the ack-onepilot component:
onectl addon install ack-onepilot
Expected output:
Addon ack-onepilot, version **** installed.
Use the console
Configure a RAM policy. Before you install the component, you must specify your AccessKey pair in the registered cluster. The AccessKey pair is used to acquire cloud service access permissions.
Create a RAM user. For more information, see Create a RAM user.
Create a custom policy. For more information, see Create custom policies.
The
ack-onepilot
component requires the permissions in the following policy:{ "Version": "1", "Statement": [ { "Action": "arms:*", "Resource": "*", "Effect": "Allow" } ] }
Attach the custom policy to the RAM user. For more information, see Authorize a RAM user.
Create an AccessKey pair for the RAM user. For more information, see Create an AccessKey pair.
Use the AccessKey pair to create a Secret named
alibaba-addon-secret
in the registered cluster.Run the following command to create a Secret used by the
ack-onepilot
component.NoteYou need to replace
access-key-id
andaccess-key-secret
in the command with the AccessKey ID and AccessKey secret you created in the previous step.kubectl -n ack-onepilot create secret generic alibaba-addon-secret --from-literal='access-key-id=<your AccessKey ID>' --from-literal='access-key-secret=<your AccessKey Secret>'
Install the
ack-onepilot
component.Log on to the ACK console. In the left-side navigation pane, click Clusters.
On the Clusters page, click the name of the cluster that you want to manage and choose in the left-side navigation pane.
On the Add-ons page, click the Logs and Monitoring tab, find the ack-onepilot card, and then click Install in the lower-right corner.
In the Install ack-onepilot dialog box, configure the parameters and click OK.
Step 2: Enable ARMS for a Java application
To enable Application Monitoring when you create an application, perform the following steps:
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 Applications in the Actions column.
On the Deployments page, click Create from YAML in the upper-right corner of the page.
On the page that appears, select a template from the Sample Template drop-down list, and add the following
labels
to the spec > template > metadata section in the Template code editor:labels: armsPilotAutoEnable: "on" armsPilotCreateAppName: "<your-deployment-name>" # Replace <your-deployment-name> with the actual application name. armsSecAutoEnable: "on" # If you want to connect the application to Application Security, you must configure this parameter.
NoteFor more information about Application Security, see What is Application Security?
For more information about the billing rules of Application Security, see Billing.
The following YAML template shows how to create a Deployment application and enable Application Monitoring for the application:
On the Deployments page, click ARMS Console in the Actions column of the Java application to navigate to the ARMS console and perform service governance.
What to do next
Uninstall ack-onepilot for all applications in the cluster
Use onectl
Run the following command to uninstall the ack-onepilot component:
onectl addon uninstall ack-onepilot
Expected output:
Addon ack-onepilot uninstalled.
Restart your application pod.
Use the console
Log on to the ACK console. In the left-side navigation pane, click Clusters.
On the Clusters page, click the name of the cluster that you want to manage and choose in the left-side navigation pane.
On the Add-ons page, click the Logs and Monitoring tab, find the ack-onepilot component, and then click Uninstall in the lower-right corner.
In the message that appears, click OK.
Restart your application pod.
Uninstall ack-onepilot for an application in the cluster
Log on to the ACK console. In the left-side navigation pane, click Clusters.
On the Clusters page, click the name of the desired cluster and choose in the left-side navigation pane.
On the Deployments page, choose More > View in YAML in the Actions column of the application that you want to manage. In the Edit YAML dialog box, delete the
labels
that you added in Step 2, and then click Update.Restart your application pod.