Create a Rule Group
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.
Prerequisites
The WhizardTelemetry Alerting extension must be installed and enabled on the KubeSphere platform.
You should join a cluster or a project and have the Rule Group Management permission within the cluster or the project. For more information, refer to "Cluster Roles" and "Project Roles".
Steps
Log in to the KubeSphere web console with a user who has the Rule Group Management permission and enter your cluster or project.
Click Monitoring & Alerting > Rule Groups in the left navigation pane.
On the Rule Groups page, click Custom Rule Groups or Built-in Rule Groups to open the rule group list.
Click Create on the page.
On the Basic Information tab, set the basic information of 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. 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.
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
Parameter Description 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.
Parameter Description Resource Type
The type of workload to be monitored, such as Deployments, StatefulSets, DaemonSets. Only displayed in the alert rule settings for projects.
Monitoring Target
The target to be monitored, such as cluster nodes, workloads, etc.
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 through a PromQL expression.
Parameter Description 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.
After completing the alert rule settings, click to save the settings, then click Create.
The rule group will be displayed in the rule group list after creation.
Feedback
Was this page Helpful?
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.