Skip to content

Instantly share code, notes, and snippets.

Avatar

Martin Hauskrecht martinhaus

View GitHub Profile
View gist:489928e564434e2cbd19b065c54693eb
alert: K8SNodeCPUUtilization
Expr: node:node_container_cpu_usage_seconds:irate1m / node:node_allocatable_cpu_cores:sum) * 100 > 90
for: 5m
labels:
group: system
severity: high
annotations:
identifier: '{{ $labels.kubernetes_cluster }}/{{ $labels.instance_name }}'
msg: Node CPU ultilization by containers has been over 90% for more than 5m.
reason: Node CPU ultilization by containers is high. Recalculate CPU request and
View gist:2c15961e8aaaf7d01e500edb234219c5
alert: K8SNodeCPUUtilizationDev
Expr: node:node_container_cpu_usage_seconds:irate1m{kubernetes_cluster=”kube-dev”} / node:node_allocatable_cpu_cores:sum{kubernetes_cluster=”kube-dev”}) * 100 > 90
for: 1h
labels:
group: system
severity: warning
annotations:
identifier: '{{ $labels.kubernetes_cluster }}/{{ $labels.instance_name }}'
msg: Node CPU ultilization by containers has been over 90% for more than 1h.
reason: Node CPU ultilization by containers is high. Recalculate CPU request and
View gist:dc0343c7de5f7f4362a324aee52bdbc6
alert: K8SNodeCPUUtilization
Expr: node:node_container_cpu_usage_seconds:irate1m{kubernetes_cluster!="kube-dev"} / node:node_allocatable_cpu_cores:sum{kubernetes_cluster!="kube-dev"}) * 100 > 90
for: 5m
labels:
group: system
severity: high
annotations:
identifier: '{{ $labels.kubernetes_cluster }}/{{ $labels.instance_name }}'
msg: Node CPU ultilization by containers has been over 90% for more than 5m.
reason: Node CPU ultilization by containers is high. Recalculate CPU request and
View gist:66ae1262f36539536f749ea2d97600df
- alert: K8SNodeCPUUtilizationDev
override: ["K8SNodeCPUUtilization"]
enabled: true
expr: K8SNodeCPUUtilization{kubernetes_cluster="kube-dev"}
for: 1h
labels:
severity: warning
annotations:
identifier: '{{ $labels.kubernetes_cluster }}/{{ $labels.instance_name }}'
msg: Node CPU ultilization by containers has been over 90% for more than 5m.
View gist:014baecac79127f74bdfd6294cae3fb4
# The generic rule
- alert: K8SNodeCPUUtilization
expr: K8SNodeCPUUtilization > 90
for: 5m
labels:
severity: high
annotations:
identifier: '{{ $labels.kubernetes_cluster }}/{{ $labels.instance_name }}'
msg: Node CPU ultilization by containers has been over 90% for more than 5m.
View gist:0b700bb11dc78f8df9d839769b24c101
# The result after pre-processing.
- alert: K8SNodeCPUUtilization
expr: K8SNodeCPUUtilization{kubernetes_cluster!="kube-dev"} > 90
for: 5m
labels:
severity: high
annotations:
identifier: '{{ $labels.kubernetes_cluster }}/{{ $labels.instance_name }}'
msg: Node CPU ultilization by containers has been over 90% for more than 5m.
View gist:52fd34f6503824a4f8548838a3785faf
- alert: DisableKubeDev
override: ["K8S.*"]
enabled: false
expr: '{kubernetes_cluster="kube-dev"}'