Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes and improvements to kube-stack-prometheus alerts #2386

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions helmfile.d/charts/prometheus-alerts/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# Changelog

## 2025.01.03

1. helmfile.d/charts/prometheus-alerts/templates/alerts/alertmanager.rules.yaml
- MODIFIED - Added runbookURLs for the alertmanager alerts
1. helmfile.d/charts/prometheus-alerts/templates/alerts/kubernetes-resources.yaml
- MODIFIED - KubeCPUOvercommit properly compute per cluster as done upstream
- MODIFIED - KubeMemoryOvercommit properly compute per cluster as done upstream
1. helmfile.d/charts/prometheus-alerts/templates/alerts/kube-state-metrics.yaml
- MODIFIED - KubeStateMetricsListErrors properly compute per cluster as done upstream
- MODIFIED - KubeStateMetricsWatchErrors properly compute per cluster as done upstream
- MODIFIED - KubeStateMetricsShardingMismatch properly compute per cluster as done upstream
- MODIFIED - KubeStateMetricsShardsMissing properly compute per cluster as done upstream

## 2022.12.01

1. helmfile/charts/prometheus-alerts/templates/alerts/kubernetes-system-kubelet.yaml
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ spec:
- alert: AlertmanagerConfigInconsistent
annotations:
description: Alertmanager instances within the {{`{{`}}$labels.job{{`}}`}} cluster have different configurations.
runbook_url: {{ .Values.defaultRules.runbookUrl }}/alertmanager/alertmanagerconfiginconsistent
summary: Alertmanager instances within the same cluster have different configurations.
expr: |-
count by (cluster,service) (
Expand All @@ -40,6 +41,7 @@ spec:
- alert: AlertmanagerFailedReload
annotations:
description: Configuration has failed to load for {{`{{`}} $labels.namespace {{`}}`}}/{{`{{`}} $labels.pod{{`}}`}}.
runbook_url: {{ .Values.defaultRules.runbookUrl }}/alertmanager/alertmanagerfailedreload
summary: Reloading an Alertmanager configuration has failed.
expr: |-
# Without max_over_time, failed scrapes could create false negatives, see
Expand All @@ -51,6 +53,7 @@ spec:
- alert: AlertmanagerMembersInconsistent
annotations:
description: Alertmanager {{`{{`}} $labels.namespace {{`}}`}}/{{`{{`}} $labels.pod{{`}}`}} has only found {{`{{`}} $value {{`}}`}} members of the {{`{{`}}$labels.job{{`}}`}} cluster.
runbook_url: {{ .Values.defaultRules.runbookUrl }}/alertmanager/alertmanagermembersinconsistent
summary: A member of an Alertmanager cluster has not found all other cluster members.
expr: |-
# Without max_over_time, failed scrapes could create false negatives, see
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ spec:
runbook_url: {{ .Values.defaultRules.runbookUrl }}kube-state-metrics/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",result="error"}[5m])) by (cluster)
Xartos marked this conversation as resolved.
Show resolved Hide resolved
/
sum(rate(kube_state_metrics_list_total{job="kube-state-metrics"}[5m])))
sum(rate(kube_state_metrics_list_total{job="kube-state-metrics"}[5m])) by (cluster))
> 0.01
for: 15m
labels:
Expand All @@ -39,9 +39,9 @@ spec:
runbook_url: {{ .Values.defaultRules.runbookUrl }}kube-state-metrics/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",result="error"}[5m])) by (cluster)
/
sum(rate(kube_state_metrics_watch_total{job="kube-state-metrics"}[5m])))
sum(rate(kube_state_metrics_watch_total{job="kube-state-metrics"}[5m])) by (cluster))
> 0.01
for: 15m
labels:
Expand All @@ -54,7 +54,7 @@ spec:
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 }}kube-state-metrics/kubestatemetricsshardingmismatch
summary: kube-state-metrics sharding is misconfigured.
expr: stdvar (kube_state_metrics_total_shards{job="kube-state-metrics"}) != 0
expr: stdvar (kube_state_metrics_total_shards{job="kube-state-metrics"}) by (cluster) != 0
for: 15m
labels:
severity: critical
Expand All @@ -67,9 +67,9 @@ spec:
runbook_url: {{ .Values.defaultRules.runbookUrl }}kube-state-metrics/kubestatemetricsshardsmissing
summary: kube-state-metrics shards are missing.
expr: |-
2^max(kube_state_metrics_total_shards{job="kube-state-metrics"}) - 1
2^max(kube_state_metrics_total_shards{job="kube-state-metrics"}) by (cluster) - 1
-
sum( 2 ^ max by (shard_ordinal) (kube_state_metrics_shard_ordinal{job="kube-state-metrics"}) )
sum( 2 ^ max by (shard_ordinal) (kube_state_metrics_shard_ordinal{job="kube-state-metrics"})) by (cluster)
!= 0
for: 15m
labels:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ spec:
runbook_url: {{ .Values.defaultRules.runbookUrl }}kubernetes/kubecpuovercommit
summary: Cluster has overcommitted CPU resource requests.
expr: |-
sum(namespace_cpu:kube_pod_container_resource_requests:sum{}) - (sum(kube_node_status_allocatable{resource="cpu"}) - max(kube_node_status_allocatable{resource="cpu"})) > 0
sum(namespace_cpu:kube_pod_container_resource_requests:sum{}) by (cluster) - (sum(kube_node_status_allocatable{resource="cpu"}) by (cluster) - max(kube_node_status_allocatable{resource="cpu"}) by (cluster)) > 0
and
(sum(kube_node_status_allocatable{resource="cpu"}) - max(kube_node_status_allocatable{resource="cpu"})) > 0
(sum(kube_node_status_allocatable{resource="cpu"}) by (cluster) - max(kube_node_status_allocatable{resource="cpu"}) by (cluster)) > 0
for: 10m
labels:
severity: warning
Expand All @@ -38,9 +38,9 @@ spec:
runbook_url: {{ .Values.defaultRules.runbookUrl }}kubernetes/kubememoryovercommit
summary: Cluster has overcommitted memory resource requests.
expr: |-
sum(namespace_memory:kube_pod_container_resource_requests:sum{}) - (sum(kube_node_status_allocatable{resource="memory"}) - max(kube_node_status_allocatable{resource="memory"})) > 0
sum(namespace_memory:kube_pod_container_resource_requests:sum{}) by (cluster) - (sum(kube_node_status_allocatable{resource="memory"}) by (cluster) - max(kube_node_status_allocatable{resource="memory"}) by (cluster)) > 0
and
(sum(kube_node_status_allocatable{resource="memory"}) - max(kube_node_status_allocatable{resource="memory"})) > 0
(sum(kube_node_status_allocatable{resource="memory"}) by (cluster) - max(kube_node_status_allocatable{resource="memory"}) by (cluster)) > 0
for: 10m
labels:
severity: warning
Expand Down
2 changes: 2 additions & 0 deletions helmfile.d/values/kube-prometheus-stack-sc.yaml.gotmpl
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ defaultRules:
create: false

kube-state-metrics:
selfMonitor:
enabled: true
resources: {{- toYaml .Values.kubeStateMetrics.resources | nindent 4 }}
{{- if .Values.clusterApi.enabled }}
rbac:
Expand Down
2 changes: 2 additions & 0 deletions helmfile.d/values/kube-prometheus-stack-wc.yaml.gotmpl
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ prometheusOperator:
resources: {{- toYaml .Values.prometheusOperator.prometheusConfigReloader.resources | nindent 6 }}

kube-state-metrics:
selfMonitor:
enabled: true
resources: {{- toYaml .Values.kubeStateMetrics.resources | nindent 4 }}
{{- if .Values.clusterApi.enabled }}
rbac:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ policies:
- rule: ingress-rule-prometheus
ports:
- tcp: 8080
- tcp: 8081

{{- if eq .Environment.Name "service_cluster" }}
{{- if eq .Values.objectStorage.type "s3" | and .Values.s3Exporter.enabled .Values.networkPolicies.s3Exporter.enabled }}
Expand Down
Loading