This topic describes how to create a Prometheus instance to monitor a self-managed or third-party Kubernetes cluster. After you create a Prometheus instance, you can use preset dashboards to monitor the host and view the performance metrics of the Kubernetes cluster.

Prerequisites

Application Real-Time Monitoring Service (ARMS) is activated. For more information, see Activate and upgrade ARMS.
Note

If your Kubernetes cluster is connected to the Alibaba Cloud internal network, you can perform the steps in this topic to connect the Kubernetes cluster to Prometheus Service. If your Kubernetes cluster is connected to the Internet and you want to connect the Kubernetes cluster to Prometheus Service, see Connect a Kubernetes cluster to ARMS Prometheus over the Internet.

Create a Prometheus instance to monitor a Kubernetes cluster

To monitor a self-managed or third-party Kubernetes cluster by using Prometheus Service, you must install a Prometheus agent. Perform the following operations:

  1. Log on to the ARMS console .
  2. In the left-side navigation pane, choose Prometheus Monitoring > Prometheus Instances.
  3. In the top navigation bar of the Prometheus Monitoring page, select a region. Then, click Create Prometheus instance in the upper-right corner of the page.
  4. On the Create Prometheus instance page, click Prometheus Instance for Kubernetes.
  5. In the upper-right corner of the Integrate Self-managed Kubernetes Cluster panel, select the region of the Kubernetes cluster that you want to monitor. Then, perform the following steps:
    1. Specify the name of the Prometheus instance and click Create.
    2. Run the following command to add the Alibaba Cloud Helm repository.
      Notice The command that is used to add the Helm repository varies with the region. Replace the {region_id} parameter with an actual region ID. You can also obtain the command from the Integrate Self-managed Kubernetes Cluster panel.
      helm repo add aliyun http://aliacs-k8s-{region_id}.oss-{region_id}.aliyuncs.com/app/charts-incubator/
    3. Run the command in the Install the Prometheus agent section to install the Prometheus agent for the self-managed Kubernetes cluster.
      helm install arms-prom-operator aliyun/ack-arms-prometheus \
        --namespace arms-prom \
        --set controller.cluster_id=$CLUSTER_ID \    // Obtain the cluster ID from the Install the Prometheus agent section. 
        --set controller.uid="***" \                 // Obtain the UID from the Install the Prometheus agent section. 
        --set controller.region_id=*** \             // Obtain the region ID from the Install the Prometheus agent section. 
        --set controller.vpc_prefix=registry.        // Pull images from a container registry over the Internet. If your image is stored in the internal network of Alibaba Cloud, you do not need to set this parameter. 
      Note For more information, see Parameters of the Helm command.
    After you connect a self-managed or third-party Kubernetes cluster to Prometheus Service, the cluster is displayed on the Prometheus Monitoring page.

View monitoring data

After you connect a self-managed or third-party Kubernetes cluster to Prometheus Service, you can view monitoring data on Grafana dashboards.

  1. Log on to the ARMS console .
  2. In the left-side navigation pane, choose Prometheus Monitoring > Prometheus Instances.
  3. In the top navigation bar of the Prometheus Monitoring page, select a region. Then, click the name of the self-managed Kubernetes cluster that you want to manage.
  4. On the Dashboards page, click the name of the dashboard that you want to view.
    Note For more information about Grafana dashboards, see Basic Grafana dashboards.

Stop monitoring a self-managed Kubernetes cluster

If you no longer want to monitor a self-managed Kubernetes cluster by using Prometheus Service, you can perform the following steps to uninstall the Prometheus agent:

  1. Log on to the ARMS console .
  2. In the left-side navigation pane, choose Prometheus Monitoring > Prometheus Instances.
  3. In the top navigation bar of the Prometheus Monitoring page, select a region. Find the Kubernetes cluster for which you want to uninstall the Prometheus agent, and then click Uninstall in the Actions column. In the Confirmation dialog box, click OK.
    After you uninstall the Prometheus agent, the self-managed Kubernetes cluster is no longer displayed on the Prometheus Monitoring page.