I have kube-prometheus stack setup in my cluster. I need a rule that alerts me whenever a new node is created.
My cluster is in AWS EKS and a monitoring stack setup with these components,
Alertmanager, prometheus, prometheus-operator, node-exporter, grafana.
I got the rules if a node is down,
- alert: InstanceDown
expr: |
up == 0
labels:
severity: critical
annotations:
summary: “Instance [{{ $labels.instance }}] down”
description: “Instance [{{ $labels.instance }}] down”
I need a rule that if a new worker node is created, We should get an alert,
I tried this query in Grafana to see if I'm getting any results. But when the cluster autoscaler created a new node, the query didn't return any results. I got this query from this case
(group by (kubernetes_io_hostname, kubernetes_io_role) (container_memory_working_set_bytes ) * 0 or group by (kubernetes_io_hostname, kubernetes_io_role) (delta ( container_memory_working_set_bytes[1m]))) == 1
I added the Prometheus rule, New nodes were created by cluster autoscaler but I didn't get any alerts,
- alert: NewInstanceUP
expr: |
(group by (kubernetes_io_hostname, kubernetes_io_role)(container_memory_working_set_bytes ) * 0 or group by
(kubernetes_io_hostname, kubernetes_io_role) (delta (
container_memory_working_set_bytes[1m]))) == 1
labels:
severity: critical
annotations:
summary: “Instance [{{ $labels.instance }}] UP”
description: “Instance [{{ $labels.instance }}] UP”