mirror of https://git.rancher.io/charts
87 lines
4.3 KiB
YAML
87 lines
4.3 KiB
YAML
|
{{- /*
|
||
|
Generated from 'kube-state-metrics' group from https://raw.githubusercontent.com/prometheus-operator/kube-prometheus/main/manifests/kube-state-metrics-prometheusRule.yaml
|
||
|
Do not change in-place! In order to change this file first read following link:
|
||
|
https://github.com/prometheus-community/helm-charts/tree/main/charts/kube-prometheus-stack/hack
|
||
|
*/ -}}
|
||
|
{{- $kubeTargetVersion := default .Capabilities.KubeVersion.GitVersion .Values.kubeTargetVersionOverride }}
|
||
|
{{- if and (semverCompare ">=1.14.0-0" $kubeTargetVersion) (semverCompare "<9.9.9-9" $kubeTargetVersion) .Values.defaultRules.create .Values.defaultRules.rules.kubeStateMetrics }}
|
||
|
apiVersion: monitoring.coreos.com/v1
|
||
|
kind: PrometheusRule
|
||
|
metadata:
|
||
|
name: {{ printf "%s-%s" (include "kube-prometheus-stack.fullname" .) "kube-state-metrics" | trunc 63 | trimSuffix "-" }}
|
||
|
namespace: {{ template "kube-prometheus-stack.namespace" . }}
|
||
|
labels:
|
||
|
app: {{ template "kube-prometheus-stack.name" . }}
|
||
|
{{ include "kube-prometheus-stack.labels" . | indent 4 }}
|
||
|
{{- if .Values.defaultRules.labels }}
|
||
|
{{ toYaml .Values.defaultRules.labels | indent 4 }}
|
||
|
{{- end }}
|
||
|
{{- if .Values.defaultRules.annotations }}
|
||
|
annotations:
|
||
|
{{ toYaml .Values.defaultRules.annotations | indent 4 }}
|
||
|
{{- end }}
|
||
|
spec:
|
||
|
groups:
|
||
|
- name: kube-state-metrics
|
||
|
rules:
|
||
|
- alert: KubeStateMetricsListErrors
|
||
|
annotations:
|
||
|
description: kube-state-metrics is experiencing errors at an elevated rate in list operations. This is likely causing it to not be able to expose metrics about Kubernetes objects correctly or at all.
|
||
|
runbook_url: {{ .Values.defaultRules.runbookUrl }}alert-name-kubestatemetricslisterrors
|
||
|
summary: kube-state-metrics is experiencing errors in list operations.
|
||
|
expr: |-
|
||
|
(sum(rate(kube_state_metrics_list_total{job="kube-state-metrics",result="error"}[5m]))
|
||
|
/
|
||
|
sum(rate(kube_state_metrics_list_total{job="kube-state-metrics"}[5m])))
|
||
|
> 0.01
|
||
|
for: 15m
|
||
|
labels:
|
||
|
severity: critical
|
||
|
{{- if .Values.defaultRules.additionalRuleLabels }}
|
||
|
{{ toYaml .Values.defaultRules.additionalRuleLabels | indent 8 }}
|
||
|
{{- end }}
|
||
|
- alert: KubeStateMetricsWatchErrors
|
||
|
annotations:
|
||
|
description: kube-state-metrics is experiencing errors at an elevated rate in watch operations. This is likely causing it to not be able to expose metrics about Kubernetes objects correctly or at all.
|
||
|
runbook_url: {{ .Values.defaultRules.runbookUrl }}alert-name-kubestatemetricswatcherrors
|
||
|
summary: kube-state-metrics is experiencing errors in watch operations.
|
||
|
expr: |-
|
||
|
(sum(rate(kube_state_metrics_watch_total{job="kube-state-metrics",result="error"}[5m]))
|
||
|
/
|
||
|
sum(rate(kube_state_metrics_watch_total{job="kube-state-metrics"}[5m])))
|
||
|
> 0.01
|
||
|
for: 15m
|
||
|
labels:
|
||
|
severity: critical
|
||
|
{{- if .Values.defaultRules.additionalRuleLabels }}
|
||
|
{{ toYaml .Values.defaultRules.additionalRuleLabels | indent 8 }}
|
||
|
{{- end }}
|
||
|
- alert: KubeStateMetricsShardingMismatch
|
||
|
annotations:
|
||
|
description: kube-state-metrics pods are running with different --total-shards configuration, some Kubernetes objects may be exposed multiple times or not exposed at all.
|
||
|
runbook_url: {{ .Values.defaultRules.runbookUrl }}alert-name-kubestatemetricsshardingmismatch
|
||
|
summary: kube-state-metrics sharding is misconfigured.
|
||
|
expr: stdvar (kube_state_metrics_total_shards{job="kube-state-metrics"}) != 0
|
||
|
for: 15m
|
||
|
labels:
|
||
|
severity: critical
|
||
|
{{- if .Values.defaultRules.additionalRuleLabels }}
|
||
|
{{ toYaml .Values.defaultRules.additionalRuleLabels | indent 8 }}
|
||
|
{{- end }}
|
||
|
- alert: KubeStateMetricsShardsMissing
|
||
|
annotations:
|
||
|
description: kube-state-metrics shards are missing, some Kubernetes objects are not being exposed.
|
||
|
runbook_url: {{ .Values.defaultRules.runbookUrl }}alert-name-kubestatemetricsshardsmissing
|
||
|
summary: kube-state-metrics shards are missing.
|
||
|
expr: |-
|
||
|
2^max(kube_state_metrics_total_shards{job="kube-state-metrics"}) - 1
|
||
|
-
|
||
|
sum( 2 ^ max by (shard_ordinal) (kube_state_metrics_shard_ordinal{job="kube-state-metrics"}) )
|
||
|
!= 0
|
||
|
for: 15m
|
||
|
labels:
|
||
|
severity: critical
|
||
|
{{- if .Values.defaultRules.additionalRuleLabels }}
|
||
|
{{ toYaml .Values.defaultRules.additionalRuleLabels | indent 8 }}
|
||
|
{{- end }}
|
||
|
{{- end }}
|