Skip to content

Commit b923bea

Browse files
committed
Merge remote-tracking branch 'upstream/master' into kubelet-eviction
2 parents 5b396f1 + 96d585c commit b923bea

File tree

9 files changed

+422
-356
lines changed

9 files changed

+422
-356
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ clean:
9090

9191
.PHONY: test
9292
test: $(PROMTOOL_BIN) prometheus_alerts.yaml prometheus_rules.yaml
93-
@$(PROMTOOL_BIN) test rules tests.yaml
93+
@$(PROMTOOL_BIN) test rules tests/*.yaml
9494

9595
$(BIN_DIR):
9696
mkdir -p $(BIN_DIR)

alerts/kubelet.libsonnet

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,14 +81,16 @@ local utils = import '../lib/utils.libsonnet';
8181
// Some node has a capacity of 1 like AWS's Fargate and only exists while a pod is running on it.
8282
// We have to ignore this special node in the KubeletTooManyPods alert.
8383
expr: |||
84-
count by (%(clusterLabel)s, node) (
85-
(kube_pod_status_phase{%(kubeStateMetricsSelector)s, phase="Running"} == 1)
86-
* on (%(clusterLabel)s, namespace, pod) group_left (node)
87-
group by (%(clusterLabel)s, namespace, pod, node) (
88-
kube_pod_info{%(kubeStateMetricsSelector)s}
84+
(
85+
max by (%(clusterLabel)s, instance) (
86+
kubelet_running_pods{%(kubeletSelector)s} > 1
87+
)
88+
* on (%(clusterLabel)s, instance) group_left(node)
89+
max by (%(clusterLabel)s, instance, node) (
90+
kubelet_node_name{%(kubeletSelector)s}
8991
)
9092
)
91-
/
93+
/ on (%(clusterLabel)s, node) group_left()
9294
max by (%(clusterLabel)s, node) (
9395
kube_node_status_capacity{%(kubeStateMetricsSelector)s, resource="pods"} != 1
9496
) > 0.95

dashboards/dashboards.libsonnet

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@
66
(import 'scheduler.libsonnet') +
77
(import 'proxy.libsonnet') +
88
(import 'kubelet.libsonnet') +
9-
(import 'defaults.libsonnet')
9+
(import 'defaults.libsonnet') +
10+
(import 'windows.libsonnet')

dashboards/windows.libsonnet

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,7 @@ local var = g.dashboard.variable;
7272
)
7373
+ var.query.generalOptions.withLabel('instance')
7474
+ var.query.refresh.onTime()
75-
+ var.query.generalOptions.showOnDashboard.withLabelAndValue()
76-
+ var.query.selectionOptions.withMulti(true),
75+
+ var.query.generalOptions.showOnDashboard.withLabelAndValue(),
7776

7877
namespace:
7978
var.query.new('namespace')
@@ -124,7 +123,7 @@ local var = g.dashboard.variable;
124123
statPanel(
125124
'CPU Utilisation',
126125
'none',
127-
'1 - avg(rate(windows_cpu_time_total{%(clusterLabel)s="$cluster", %(windowsExporterSelector)s, mode="idle"}[1m]))' % $._config
126+
'1 - avg(rate(windows_cpu_time_total{%(clusterLabel)s="$cluster", %(windowsExporterSelector)s, mode="idle"}[%(grafanaIntervalVar)s]))' % $._config
128127
)
129128
+ stat.gridPos.withW(4)
130129
+ stat.gridPos.withH(3),
@@ -830,13 +829,13 @@ local var = g.dashboard.variable;
830829
+ tsPanel.queryOptions.withTargets([
831830
prometheus.new(
832831
'${datasource}',
833-
'sort_desc(sum by (container) (rate(windows_container_network_received_bytes_total{%(clusterLabel)s="$cluster", namespace="$namespace", pod="$pod"}[1m])))' % $._config
832+
'sort_desc(sum by (container) (rate(windows_container_network_received_bytes_total{%(clusterLabel)s="$cluster", namespace="$namespace", pod="$pod"}[%(grafanaIntervalVar)s])))' % $._config
834833
)
835834
+ prometheus.withLegendFormat('Received : {{ container }}'),
836835

837836
prometheus.new(
838837
'${datasource}',
839-
'sort_desc(sum by (container) (rate(windows_container_network_transmitted_bytes_total{%(clusterLabel)s="$cluster", namespace="$namespace", pod="$pod"}[1m])))' % $._config
838+
'sort_desc(sum by (container) (rate(windows_container_network_transmitted_bytes_total{%(clusterLabel)s="$cluster", namespace="$namespace", pod="$pod"}[%(grafanaIntervalVar)s])))' % $._config
840839
)
841840
+ prometheus.withLegendFormat('Transmitted : {{ container }}'),
842841
]),
@@ -1025,19 +1024,19 @@ local var = g.dashboard.variable;
10251024
+ tsPanel.queryOptions.withTargets([
10261025
prometheus.new(
10271026
'${datasource}',
1028-
'max(rate(windows_logical_disk_read_bytes_total{%(clusterLabel)s="$cluster", %(windowsExporterSelector)s, instance="$instance"}[2m]))' % $._config
1027+
'max(rate(windows_logical_disk_read_bytes_total{%(clusterLabel)s="$cluster", %(windowsExporterSelector)s, instance="$instance"}[%(grafanaIntervalVar)s]))' % $._config
10291028
)
10301029
+ prometheus.withLegendFormat('read'),
10311030

10321031
prometheus.new(
10331032
'${datasource}',
1034-
'max(rate(windows_logical_disk_write_bytes_total{%(clusterLabel)s="$cluster", %(windowsExporterSelector)s, instance="$instance"}[2m]))' % $._config
1033+
'max(rate(windows_logical_disk_write_bytes_total{%(clusterLabel)s="$cluster", %(windowsExporterSelector)s, instance="$instance"}[%(grafanaIntervalVar)s]))' % $._config
10351034
)
10361035
+ prometheus.withLegendFormat('written'),
10371036

10381037
prometheus.new(
10391038
'${datasource}',
1040-
'max(rate(windows_logical_disk_read_seconds_total{%(clusterLabel)s="$cluster", %(windowsExporterSelector)s, instance="$instance"}[2m]) + rate(windows_logical_disk_write_seconds_total{%(clusterLabel)s="$cluster", %(windowsExporterSelector)s, instance="$instance"}[2m]))' % $._config
1039+
'max(rate(windows_logical_disk_read_seconds_total{%(clusterLabel)s="$cluster", %(windowsExporterSelector)s, instance="$instance"}[%(grafanaIntervalVar)s]) + rate(windows_logical_disk_write_seconds_total{%(clusterLabel)s="$cluster", %(windowsExporterSelector)s, instance="$instance"}[%(grafanaIntervalVar)s]))' % $._config
10411040
)
10421041
+ prometheus.withLegendFormat('io time'),
10431042
])

rules/rules.libsonnet

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22
(import 'apps.libsonnet') +
33
(import 'kube_scheduler.libsonnet') +
44
(import 'node.libsonnet') +
5-
(import 'kubelet.libsonnet')
5+
(import 'kubelet.libsonnet') +
6+
(import 'windows.libsonnet')

0 commit comments

Comments
 (0)