Skip to content

Commit 1165e71

Browse files
committed
feat(alerts): New KubePdbNotEnoughHealthyPods alert
1 parent 5894150 commit 1165e71

File tree

3 files changed

+282
-165
lines changed

3 files changed

+282
-165
lines changed

alerts/apps_alerts.libsonnet

+23
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ local utils = import '../lib/utils.libsonnet';
55
kubeStateMetricsSelector: error 'must provide selector for kube-state-metrics',
66
kubeJobTimeoutDuration: error 'must provide value for kubeJobTimeoutDuration',
77
kubeDaemonSetRolloutStuckFor: '15m',
8+
kubePdbNotEnoughHealthyPodsFor: '15m',
89
namespaceSelector: null,
910
prefixedNamespaceSelector: if self.namespaceSelector != null then self.namespaceSelector + ',' else '',
1011
},
@@ -359,6 +360,28 @@ local utils = import '../lib/utils.libsonnet';
359360
'for': '15m',
360361
alert: 'KubeHpaMaxedOut',
361362
},
363+
{
364+
expr: |||
365+
(
366+
kube_poddisruptionbudget_status_desired_healthy{%(prefixedNamespaceSelector)s%(kubeStateMetricsSelector)s}
367+
-
368+
kube_poddisruptionbudget_status_current_healthy{%(prefixedNamespaceSelector)s%(kubeStateMetricsSelector)s}
369+
)
370+
> 0
371+
||| % $._config,
372+
labels: {
373+
severity: 'warning',
374+
},
375+
annotations: {
376+
description: 'PDB %s{{ $labels.namespace }}/{{ $labels.poddisruptionbudget }} expects {{ $value }} more healthy pods. The desired number of healthy pods has not been met for at least %s.' % [
377+
utils.ifShowMultiCluster($._config, '{{ $labels.%(clusterLabel)s }}/' % $._config),
378+
$._config.kubePdbNotEnoughHealthyPodsFor,
379+
],
380+
summary: 'PDB does not have enough healthy pods.',
381+
},
382+
'for': $._config.kubePdbNotEnoughHealthyPodsFor,
383+
alert: 'KubePdbNotEnoughHealthyPods',
384+
},
362385
],
363386
},
364387
],

0 commit comments

Comments
 (0)