Create a Rule Group
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
-
You need to have the platform-admin role in the KubeSphere platform. For more information, refer to Users and Platform 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
-
Log in to the KubeSphere web console with a user who has the platform-admin role.
-
In the upper right corner of the page, click the
icon and select WizTelemetry Observability Platform.
-
Click Global Alerting > Custom Rule Groups in the left navigation pane.
-
Click Create on the page.
-
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.
-
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_idis 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 via the dropdown list.
Parameter Description Monitoring Target
The cluster node or workload to be monitored.
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 via a PromQL expression.
Parameter Description Cluster Setting
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 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.
-
-
After completing the alert rule settings, click
to save the settings, then click Create.
After the rule group is created, it will be displayed in the rule group list.