All Products
Search
Document Center

:Enable the monitoring and alerting feature for Knative components

最終更新日:Jul 26, 2024

You can use Alibaba Cloud Managed Service for Prometheus to configure monitoring metrics for Knative component and specify thresholds for specific metrics to trigger alerts if the thresholds are reached. Based on Managed Service for Prometheus, you can monitor the health status of Knative components in real time and detect and handle exceptions that occur in the components at the earliest opportunity.

Prerequisites

Knative is deployed. For more information, see Deploy Knative.

Knative component metrics

Important

You can install and use Knative components free of charge. However, additional fees may be incurred in the following scenarios:

  • Knative components are non-managed components and occupy worker node resources after the Knative components are installed. You can specify the amount of resources that are requested by each module when you install the components.

  • The metrics of Knative components that are collected by Managed Service for Prometheus are custom metrics. We recommend that you understand the free quotas and billing rules of custom metrics in Managed Service for Prometheus before you enable the monitoring and alerting feature for Knative components. For more information, see Billing. You can monitor and manage your resource usage by querying the resource usage and bills. For more information, see Query the amount of observable data and bills.

Knative component

Metric

Knative Serving:

  • activator: reduces the number of pods to zero.

  • autoscaler: automatically adjusts the number of instances for Knative Services based on workloads.

  • controller: the Knative Serving controller, which is used to reconcile resources such as Knative Services.

  • controller-webhook: processes the webhook requests sent to the Knative Serving controller.

  • The number of instances available for the component.

  • The amount of CPU resources used by the component.

  • The amount of memory resources used by the component.

Knative Eventing:

  • eventing-controller: reconciles and handles events.

  • eventing-webhook: processes the webhook requests related to events.

Step 1: Install the Managed Service for Prometheus component

Enable Managed Service for Prometheus when you create a cluster

On the Component Configurations wizard page, select Enable Managed Service for Prometheus. For more information, see Create an ACK managed cluster.

image.png

By default, Enable Managed Service for Prometheus is selected when you create a cluster. After the cluster is created, the system automatically configures Managed Service for Prometheus.

Enable Managed Service for Prometheus for an existing cluster

  1. Log on to the ACK console. In the left-side navigation pane, click Clusters.

  2. On the Clusters page, find the cluster that you want to manage and click its name. In the left-side pane, choose Operations > Prometheus Monitoring.

  3. On the Prometheus Monitoring page, follow the on-screen instructions to install the required component and check the relevant dashboards.

    The system automatically installs the component and checks the dashboards. After the installation is completed, you can click each tab to view metrics.

Step 2 (optional): View pod monitoring data

Before you configure an alert rule for a pod in which the components are deployed, check the monitoring data of the pod.

  1. Log on to the Managed Service for Prometheus console.

  2. In the top navigation bar, select the region in which the cluster is deployed.

  3. In the left-side navigation pane, click Instances.

  4. In the left-side navigation pane, click Instances. On the page that appears, find the instance that you want to manage and click the instance ID in the Instances section to go to the instance details page. On the Dashboards page, find the dashboard that you want to view and click the name of the dashboard. The Grafana page appears. On the Grafana page, view the CPU utilization and memory usage of pods and the number of pods.

Step 3: Create a notification policy

Go to the Notification Policy page and create a custom notification policy. When an alert is triggered, the alert center classifies, handles, and sends notifications based on the specified notification policy. For more information about how to create a notification policy, see Create and manage a notification policy.

Step 4: Create an alert rule

  1. Log on to the Managed Service for Prometheus console.

  2. In the left-side navigation pane, click View Alert Rules. In the top navigation bar, select the region in which your cluster is deployed.

  3. In the upper-left corner of the Prometheus Alert Rules page, click Create Prometheus Alert Rule.

    You can set the Check Type parameter to Static Threshold or Custom PromQL. For more information, see Create an alert rule for a Prometheus instance.

  4. Click Completed. The alert rule immediately takes effect.

References

You can collect the Docker stdout log of Knative components by using Simple Log Service. For more information, see Collect log data of Knative components.