< img height="1" width="1" style="display:none;" alt="" src="https://px.ads.linkedin.com/collect/?pid=3131724&fmt=gif" />

Create Rule Groups

This section introduces how to create an alert rule group.

The monitoring and alerting functions of KubeSphere are implemented based on Prometheus. Each rule group can contain multiple alert rules. You can create alert rules using the rule templates provided by the system or manually enter PromQL expressions to create alert rules. For more information, see the Prometheus Documentation.

Note

KubeSphere only supports creating custom rule groups, not built-in rule groups.

Prerequisites

  • You should have the platform-admin role on the KubeSphere platform. For more information, see Users and Platform Roles.

  • To monitor the metrics of applications, you need to configure the applications running in containers to expose monitoring metrics that comply with the Prometheus specification at a certain service endpoint, and set up a monitoring exporter on the service that exposes the workload to declare the path providing application monitoring metrics. For more information, see Edit a Metrics Exporter.

Steps

  1. Log in to the KubeSphere web console with a user having the platform-admin role.

  2. Click grid in the upper-right corner of the page and click Whizard Observability Center.

  3. Click Global Alerts > Custom Rule Groups in the left navigation pane.

  4. Click Create on the page.

  5. On the Basic Information tab, set the basic information of the rule group, then click Next.

    ParameterDescription

    Name

    The name of the rule group.

    The name can only contain lowercase letters, numbers, and hyphens (-), must start and end with a lowercase letter or number, and can be up to 63 characters long.

    Alias

    The alias of the rule group. Different rule groups can have the same alias. The alias can only contain Chinese characters, letters, numbers, and hyphens (-), and cannot start or end with a hyphen (-), with a maximum of 63 characters.

    Check Interval

    The time interval between metric checks. The default value is 1 minute.

    Description

    The description of the rule group.

    The description can contain any characters, with a maximum of 256 characters.

  6. On the Alert Rules tab, click Add Alert Rule and select Rule Template or Custom Rule as needed to set the alert rule.

    • Common Parameters

      ParameterDescription

      Rule Name

      The name of the alert rule. The rule name can contain any characters and can be up to 63 characters long.

      Label Setting

      Set key-value pair labels for the alert rule, so that alerts can be filtered by labels in notification subscriptions and sent to recipients whose labels meet specific conditions.

      After the alert rule is created, a label with the key rule_id will be automatically generated.

      Summary

      The content summary of the alert message. The message summary can contain any characters and can be up to 63 characters long.

      Details

      The detailed description of the alert message. The message details can contain any characters and can be up to 256 characters long.

    • Rule Template

      Select the monitoring target and trigger condition from the dropdown list.

      ParameterDescription

      Monitoring Targets

      The cluster nodes or workloads that need to be monitored.

      Trigger Condition

      The condition that triggers the alert. You can set the metric, operator, threshold, duration, and severity of the condition. For example, a critical alert is triggered when CPU usage > 80% for 60 minutes.

    • Custom Rule

      Specify the monitoring target and trigger condition using a PromQL expression.

      ParameterDescription

      Cluster Settings

      Select the cluster where the resources to be monitored are located.

      Duration

      Set the system to wait for a period of time and check if the alert situation persists. If the alert situation persists, an alert is triggered.

      Severity

      The level of the alert, including Info, Warning, Error, Critical.

      Rule Expression

      The PromQL expression used to specify the monitoring target and trigger condition. For more information, see the Prometheus Documentation.

  7. After completing the alert rule settings, click check to save the settings, then click Create.

    The rule group will be displayed in the rule group list after creation.

Receive the latest news, articles and updates from KubeSphere


Thanks for the feedback. If you have a specific question about how to use KubeSphere, ask it on Slack. Open an issue in the GitHub repo if you want to report a problem or suggest an improvement.

What’s on this Page