Ingress controllers of Container Service for Kubernetes (ACK) allow you to stream all HTTP request logs to standard outputs. ACK is also integrated with Log Service. You can create dashboards to monitor and analyze logs. This topic describes how to use Ingress Dashboard with Application Real-Time Monitoring Service (ARMS) to monitor applications.

Prerequisites

You must install the Log Service component before you can use Ingress Dashboard to monitor applications. You can use the following methods to install the component:
  • When you create an ACK cluster, select Enable Log Service, Install Ingress Controllers, and Create Ingress Dashboard.
  • To install the component for an existing ACK cluster, go to the Add-ons page. For more information, see Use Log Service to collect container logs.

Step 1: View Ingress logs on dashboards

  1. Log on to the Log Service console.
  2. In the Projects section, click the name of the project that you want to manage. The details page of the project appears. By default, a project for a Kubernetes cluster is named in the format of k8s-log-{cluster-id}.
  3. On the page that appears, click the Dashboard icon on the left side of nginx-ingress on the Logstores tag.
    Note All Ingress access logs are stored in the nginx-ingress Logstore.
  4. Click Visual Dashboard below nginx-ingress to view the dashboards of all Ingresses.
    Ingress Dashboard contains five preset charts: Ingress Overview, Ingress Exceptions Center, Ingress Access Center, Ingress Monitoring Center for Blue/Green Deployment, and Ingress Monitoring Center. The following section introduces the Ingress Overview and Ingress Monitoring Center for Blue/Green Deployment charts. For more information about other preset charts, see Monitor and analyze the logs of nginx-ingress.

    Ingress Overview

    The Ingress Overview dashboard displays the data of a website that is monitored by nginx-ingress. You can view the following information:

    • Website data of the last 24 hours, including the number of page views (PVs), the number of unique visitors (UVs), inbound and outbound traffic, the average latency, the proportion of mobile terminal users, and the proportions of 5xx errors and 404 errors.
    • Website data of the last one minute, including the number of PVs, the number of UVs, the success rate of requests, the proportion of 5xx errors, the average latency, the P95 latency, and the P99 latency.
    • Detailed information about requests in the last 24 hours, including the PV trend (compared with the PV trend in the last seven days), regional distribution of request sources, the top 10 source areas and cities, the proportion of mobile terminal users, and the proportions of Android terminal users and iOS terminal users.
    • Top 10 URLs in the last one hour, including the 10 URLs of the highest PVs, the 10 URLs of the highest latencies, the 10 URLs that return the most 5xx errors, and the 10 URLs that return the most 404 errors.
    Ingress Overview

    Ingress Monitoring Center for Blue/Green Deployment

    The Ingress Monitoring Center for Blue/Green Deployment dashboard displays the real-time status of a service version release and compares the specified service versions. This allows you to identify exceptions and roll back the service at the earliest opportunity. You must set ServiceA and ServiceB for monitoring and comparison. The dashboard displays the following dynamic monitoring data of each service: the number of PVs, the proportion of 5xx errors, the success rate of requests, the average latency, the P95, P99, and P9999 latencies, and the traffic data.

    Ingress Monitoring Center for Blue/Green Deployment

Enable ARMS for Java applications

To enable ARMS when you create an application, perform the following steps:

  1. Log on to the ACK console.
  2. In the left-side navigation pane of the ACK console, click Clusters.
  3. On the Clusters page, find the cluster that you want to manage and click the name of the cluster or click Details in the Actions column. The details page of the cluster appears.
  4. In the left-side navigation pane of the details page, choose Workloads > Deployments.
  5. On the Deployments page, click Create from Template in the upper-right corner of the page.
  6. On the Create page, select a template from the Sample Template drop-down list and add the following annotations to the spec > template > metadata section in the template editor.
    Note Replace <your-deployment-name> with the name of your application.
    annotations:
      armsPilotAutoEnable: "on"
      armsPilotCreateAppName: "<your-deployment-name>"                                
    YAML Example

    The following YAML template shows how to create a stateless application and enable ARMS for the application.

    apiVersion: v1
    kind: Namespace
    metadata:
      name: arms-demo
    ---
    apiVersion: apps/v1beta1 # 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:
          annotations:
            armsPilotAutoEnable: "on"
            armsPilotCreateAppName: "arms-k8s-demo"
          labels:
            app: arms-springboot-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/v1beta1 # 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:
          annotations:
            armsPilotAutoEnable: "on"
            armsPilotCreateAppName: "arms-k8s-demo-subcomponent"
          labels:
            app: arms-springboot-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/v1beta1 # 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 3: Create an Ingress for the application

  1. Log on to the ACK console.
  2. In the left-side navigation pane of the ACK console, click Clusters.
  3. On the Clusters page, find the cluster that you want to manage and click the name of the cluster or click Details in the Actions column. The details page of the cluster appears.
  4. On the Ingresses page, click Create in the upper-right corner of the page.
  5. In the Create dialog box, configure the Ingress and click Create.
    For more information about how to configure an Ingress, see Create an Ingress.

Step 4: Use Ingress Dashboard with ARMS

  1. Log on to the Log Service console.
  2. In the Projects section, click the name of the project that you specified when you created the ACK cluster. The details page of the project appears. By default, a project specified for an ACK cluster is named in the format of k8s-log-{cluster-id}.
  3. On the details page, you are redirected to the Logstores tab by default. All Ingress access logs are stored in the nginx-ingress Logstore. In the left-side navigation pane, click Visual Dashboards.
  4. In the dashboard list, click Ingress Overview V1.2.
  5. On the Ingress Overview V1.2 page, click Top 10 URLs by Latency to view the top 10 URLs with the highest latency.
  6. On the Ingress Overview V1.2 page, click URL (ARMS) to view the monitoring data about the corresponding Service. You can view the trace details of a specific Service in the ARMS console.