Continental Innovates with Rancher and Kubernetes
A PrometheusRule defines a group of Prometheus alerting and/or recording rules.
Prometheus rule files are held in PrometheusRule custom resources.
A PrometheusRule allows you to define one or more RuleGroups. Each RuleGroup consists of a set of Rule objects that can each represent either an alerting or a recording rule with the following fields:
Alerting rules define alert conditions based on PromQL queries. Recording rules precompute frequently needed or computationally expensive queries at defined intervals.
For more information on what fields can be specified, please look at the Prometheus Operator spec.
Use the label selector field ruleSelector in the Prometheus object to define the rule files that you want to be mounted into Prometheus.
ruleSelector
For examples, refer to the Prometheus documentation on recording rules and alerting rules.
When you define a Rule (which is declared within a RuleGroup in a PrometheusRule resource), the spec of the Rule itself contains labels that are used by Prometheus to figure out which Route should receive this Alert. For example, an Alert with the label team: front-end will be sent to all Routes that match on that label.
team: front-end
Available as of v2.5.4
Prerequisite: The monitoring application needs to be installed.
To create rule groups in the Rancher UI,
Result: Alerts can be configured to send notifications to the receiver(s).
Rancher v2.5.4 introduced the capability to configure PrometheusRules by filling out forms in the Rancher UI.
Alerting rules allow you to define alert conditions based on PromQL (Prometheus expression language) expressions and to send notifications about firing alerts to an external service.
Recording rules allow you to precompute frequently needed or computationally expensive PromQL (Prometheus expression language) expressions and save their result as a new set of time series.
For Rancher v2.5.0-v2.5.3, PrometheusRules must be configured in YAML. For examples, refer to the Prometheus documentation on recording rules and alerting rules.