PrometheusRule

Scope: Namespaced
Version: v1

PrometheusRule defines recording and alerting rules for a Prometheus instance

  • apiVersion
    string

    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

  • kind
    string

    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

  • metadata
    object
  • spec
    object

    Required value

    Specification of desired alerting rule definitions for Prometheus.

    • spec.groups
      array of objects

      Content of Prometheus rule file

      RuleGroup is a list of sequentially evaluated recording and alerting rules.

      • spec.groups.interval
        string

        Interval determines how often rules in the group are evaluated.

        Pattern: ^(0|(([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?)$

      • spec.groups.limit
        integer

        Limit 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.

      • spec.groups.name
        string

        Required value

        Name of the rule group.

      • spec.groups.partial_response_strategy
        string

        PartialResponseStrategy 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

        Pattern: ^(?i)(abort|warn)?$

      • spec.groups.rules
        array of objects

        List of alerting and recording rules.

        Rule describes an alerting or recording rule See Prometheus documentation: alerting or recording rule

        • spec.groups.rules.alert
          string

          Name of the alert. Must be a valid label value. Only one of record and alert must be set.

        • spec.groups.rules.annotations
          object

          Annotations to add to each alert. Only valid for alerting rules.

        • spec.groups.rules.expr
          integer or string

          Required value

          PromQL expression to evaluate.

        • spec.groups.rules.for
          string

          Alerts are considered firing once they have been returned for this long.

          Pattern: ^(0|(([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?)$

        • spec.groups.rules.keep_firing_for
          string

          KeepFiringFor defines how long an alert will continue firing after the condition that triggered it has cleared.

          Pattern: ^(0|(([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?)$

        • spec.groups.rules.labels
          object

          Labels to add or overwrite.

        • spec.groups.rules.record
          string

          Name of the time series to output to. Must be a valid metric name. Only one of record and alert must be set.