This section describes how to create alert rule groups.

KubeSphere’s monitoring and alerting functionality is built on Prometheus. Each rule group can contain multiple alert rules. You can create alert rules using the system-provided rule templates or by manually entering PromQL expressions. For more information, please refer to the Prometheus official documentation.

Note

KubeSphere only supports creating custom rule groups and does not support creating built-in rule groups.

Prerequisites

  • The WizTelemetry Alerting extension must be installed and enabled on the KubeSphere platform.

  • You need to join a cluster or project and have the Rule Group Management permission in the cluster or project. For more information, please refer to Cluster Roles and Project Roles.

  • To monitor the metrics of an application, you need to configure the application running in the container to expose monitoring metrics that comply with the Prometheus specification at a certain server-side path. You also need to set up a metrics exporter on the service used to expose the workload to declare the path that provides the application monitoring metrics. For more information, see Edit a Metrics Exporter.

Steps

  1. Log in to the KubeSphere web console as a user with the Rule Group Management permission and enter your cluster or workspace.

  2. Click Monitoring and Alerting > Rule Groups in the left navigation pane.

  3. Click Create on the page.

  4. On the Basic Information tab, set the basic information for the rule group, then click Next.

    Parameter Description

    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.

    Check Interval

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

    Description

    The description information of the rule group.

    The description can contain any characters and has a maximum length of 256 characters.

  5. On the Alerting Rules tab, click Add Alerting Rule, and configure the alerting rule by selecting Rule Template or Custom Rule as needed.

    • General Parameters

      Parameter Description

      Rule Name

      The name of the alerting rule. The rule name can contain any characters, with a maximum length of 63 characters.

      Label Settings

      Set key-value pair labels for the alerting rule. This allows filtering by labels in notification subscriptions to send alert notifications that meet specific label conditions.

      After the alerting rule is created, a label with the key rule_id is automatically generated.

      Summary

      The content summary of the alert message. The message summary can contain any characters, with a maximum length of 63 characters.

      Details

      The detailed description of the alert message. The message details can contain any characters, with a maximum length of 256 characters.

    • Rule Template

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

      Parameter Description

      Resource Type

      The type of workload to be monitored, such as Deployment, StatefulSet, DaemonSet. Only displayed in project alert rule settings.

      Monitoring Target

      The target to be monitored, such as cluster nodes, workloads, etc.

      Trigger Condition

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

    • Custom Rule

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

      Parameter Description

      Duration

      Set the system to wait for a period of time and check if the alert condition persists. The alert is only triggered if the condition continues to exist.

      Alert Level

      Alert levels include Info, Warning, Important, and Critical.

      Alerting Rule Expression

      The PromQL expression used to specify the monitoring target and trigger conditions. For more information, please refer to Prometheus official documentation.

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

    After the rule group is created, it will be displayed in the rule group list.