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
Log in to the KubeSphere web console with a user having the platform-admin role.
Click in the upper-right corner of the page and click Whizard Observability Center.
Click Global Alerts > Custom Rule Groups in the left navigation pane.
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 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.
Parameter Description 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.
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.