All Products
Search
Document Center

Application Real-Time Monitoring Service:Manually connect applications to Application Monitoring eBPF

Last Updated:Jan 10, 2024

Application Monitoring eBPF is an end-to-end observability service for Kubernetes clusters. After you manually install Application Monitoring eBPF for a Kubernetes cluster, you can view the metrics, application links, logs, and events of the cluster.

Prerequisites

Note

Application Monitoring eBPF is currently being public preview. You can use Alibaba Cloud Application Monitoring eBPF for free during the public preview period. If you have any questions, contact the Application Monitoring eBPF Q&A DingTalk group (group ID: 35568145) for help.

Description

Install the Application Monitoring eBPF component for a Kubernetes cluster to connect the cluster to the Application Monitoring eBPF component.

Before the installation, you must check whether the target cluster has ARMS Addon Token. Otherwise, an error message is returned. If ARMS Addon Token exist, ARMS performs password-free authorization. After the components are installed, you can use the Application Monitoring eBPF. If no ARMS Addon Token exist, you need to manually add ARMS and Tracing Analysis policies. The following section describes how to check whether ARMS Addon Token exists and how to attach the policies to the worker RAM role:

Check whether ARMS Addon Token exists in a cluster?

  1. Log on to the ACK console. In the left-side navigation pane, click Clusters. On the Clusters page, click the name of the cluster to go to the cluster details page.

  2. In the left-side navigation pane, choose Configurations > Secrets. In the upper part of the page, select kube-system from the Namespace drop-down list and check whether addon.arms.token is displayed on the Secrets page.

Manually add a policy.

  1. Log on to the ACK console.

  2. In the left-side navigation pane, click Clusters. On the Clusters page, click the name of the cluster.

  3. On the details page of the cluster, click the Cluster Resources tab. On the tab, click the hyperlink next to Worker RAM Role.

  4. On the Permissions tab, click Grant Permission.

  5. Select AliyunARMSFullAccess and AliyunTracingAnalysisFullAccess System Permissions and click OK.

Note
  • ARMS Addon Token may not exist in specific ACK managed clusters. If you use an ACK managed cluster, we recommend that you first check whether ARMS Addon Token exists. If ARMS Addon Token does not exist, you must manually complete authorization.

  • By default, ACK dedicated clusters do not have ARMS Addon Token. You must manually complete authorization.

Install Application Monitoring eBPF components

Install components for an existing application

If the Application Monitoring eBPF component is installed in your application, log on to the ACK console and choose Operations > Components in the left-side navigation pane. On the Components page, check whether the version of the ack-arms-cmonitor component is 4.0.0 or later. If not, click Upgrade to upgrade the component to the latest version.

  1. Log on to the ACK console. In the left-side navigation pane, click Clusters. On the Clusters page, click the name of the cluster.

  2. In the left-side navigation pane, choose Operations> Cluster Topology.

  3. On the Cluster Topology page, click Install. Application Monitoring eBPF is automatically installed in the ACK console.

    Note

    The default namespace is arms-prom.

Install components when you create an application

  1. Log on to the ACK console. On the Clusters page, find the cluster that you want to manage and click Applications in the Actions column.

  2. On the Deployments page, click Create from YAML in the upper-right corner of the page.

  3. Select Sample Template and add the following labels to the spec.template.metadata level in the Template (YAML) section.

    labels:
      armseBPFAutoEnable: "on"
      armseBPFCreateAppName: "<your-deployment-name>" // Replace <your-deployment-name> with the name of your application. 

    The following YAML template shows how to create a Deployment application and enable ARMS for the Application Monitoring eBPF application:

    Expand to view the complete sample YAML file.

    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
            armseBPFAutoEnable: "on"
            armseBPFCreateAppName: "arms-k8s-demo"
        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
            armseBPFAutoEnable: "on"
            armseBPFCreateAppName: "arms-k8s-demo-subcomponent"
        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
    --

References

After you access Application Monitoring eBPF, you can view the key metrics, upstream and downstream dependent components, and topology of the ACK cluster. For more information, see Application details.