PrometheusRule

com.coreos.monitoring.v1.PrometheusRule

The `PrometheusRule` custom resource definition (CRD) defines [alerting](https://prometheus.io/docs/prometheus/latest/configuration/alerting_rules/) and [recording](https://prometheus.io/docs/prometheus/latest/configuration/recording_rules/) rules to be evaluated by `Prometheus` or `ThanosRuler` objects.

`Prometheus` and `ThanosRuler` objects select `PrometheusRule` objects using label and namespace selectors.

apiVersionstring = "monitoring.coreos.com/v1"APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values.More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
kindstring = "PrometheusRule"Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to.Cannot be updated. In CamelCase.More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
metadataobject
specobject requiredspec defines the specification of desired alerting rule definitions for Prometheus.
groups[]objectgroups defines the content of Prometheus rule file
intervalstringinterval defines how often rules in the group are evaluated.
labelsmap[string]stringlabels define the labels to add or overwrite before storing the result for its rules. The labels defined at the rule level take precedence.It requires Prometheus >= 3.0.0. The field is ignored for Thanos Ruler.
limitintegerlimit defines the number of alerts an alerting rule and series a recording rule can produce. Limit is supported starting with Prometheus >= 2.31 and Thanos Ruler >= 0.24.
namestring requiredname defines the name of the rule group.
partial_response_strategystringpartial_response_strategy is only used by ThanosRuler and will be ignored by Prometheus instances.More info: https://github.com/thanos-io/thanos/blob/main/docs/components/rule.md#partial-response
query_offsetstringquery_offset defines the offset the rule evaluation timestamp of this particular group by the specified duration into the past.It requires Prometheus >= v2.53.0. It is not supported for ThanosRuler.
rules[]objectrules defines the list of alerting and recording rules.
alertstringalert defines the name of the alert. Must be a valid label value. Only one of `record` and `alert` must be set.
annotationsmap[string]stringannotations defines annotations to add to each alert. Only valid for alerting rules.
exprobject requiredexpr defines the PromQL expression to evaluate.
forstringfor defines how alerts are considered firing once they have been returned for this long.
keep_firing_forstringkeep_firing_for defines how long an alert will continue firing after the condition that triggered it has cleared.
labelsmap[string]stringlabels defines labels to add or overwrite.
recordstringrecord defines the name of the time series to output to. Must be a valid metric name. Only one of `record` and `alert` must be set.
statusobject read-onlystatus defines the status subresource. It is under active development and is updated only when the "StatusForConfigurationResources" feature gate is enabled.Most recent observed status of the PrometheusRule.Read-only. More info: https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
bindings[]object read-onlybindings defines the list of workload resources (Prometheus, PrometheusAgent, ThanosRuler or Alertmanager) which select the configuration resource.
conditions[]object read-onlyconditions defines the current state of the configuration resource when bound to the referenced Workload object.
lastTransitionTimestring (date-time) required read-onlylastTransitionTime defines the time of the last update to the current status property.
messagestring read-onlymessage defines the human-readable message indicating details for the condition's last transition.
observedGenerationinteger (int64) read-onlyobservedGeneration defines the .metadata.generation that the condition was set based upon. For instance, if `.metadata.generation` is currently 12, but the `.status.conditions[].observedGeneration` is 9, the condition is out of date with respect to the current state of the object.
reasonstring read-onlyreason for the condition's last transition.
statusstring required read-onlystatus of the condition.
typestring required read-onlytype of the condition being reported. Currently, only "Accepted" is supported.
groupstring required read-onlygroup defines the group of the referenced resource.
namestring required read-onlyname defines the name of the referenced object.
namespacestring required read-onlynamespace defines the namespace of the referenced object.
resourcestring required read-onlyresource defines the type of resource being referenced (e.g. Prometheus, PrometheusAgent, ThanosRuler or Alertmanager).