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

Add KubePodEvictionRateHigh alert for elevated eviction rates #760

Closed
Closed
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
16 changes: 16 additions & 0 deletions alerts/resource_alerts.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
// See https://github.com/kubernetes/autoscaler/blob/master/cluster-autoscaler/FAQ.md#how-can-i-configure-overprovisioning-with-cluster-autoscaler
// for more details.
ignoringOverprovisionedWorkloadSelector: '',
# Max evictions per second that will trigger an alert. The default value generally allows for only one pod occasionally being evicted. Any more evictions than that will trigger the alert.
highEvictionRateThreshold: 0.002,
},

prometheusAlerts+:: {
Expand Down Expand Up @@ -156,6 +158,20 @@
summary: 'Processes experience elevated CPU throttling.',
},
},
{
alert: 'KubePodEvictionRateHigh',
expr: |||
sum(rate(kubelet_evictions[15m])) > %(highEvictionRateThreshold)s
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you check kube_pod_status_reason ? I think the reason label of this metric shall be used to find whther the pod has been evicted.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm looks like that metric can't be used to determine the eviction rate since the query returns results for hours/days after the eviction actually happened (those two evictions happened yesterday, but appear when searching for evictions in the last 15 minutes):
image

Maybe there's a way we could still use kube_pod_status_reason query results in the description? Or is the description limited to using results from the expr?

||| % $._config,
labels: {
severity: 'warning',
},
'for': '1m',
annotations: {
description: 'Pods are being evicted at an unexpectedly high rate of {{ $value }} pods per second. This is typically caused by pods frequently exceeding RAM/ephemeral-storage limits or by nodes being NotReady for extended periods.',
summary: 'Cluster is evicting pods at an unexpectedly high rate.',
},
},
],
},
],
Expand Down