Prometheus to get trigger an alert when node is in unschedulable state Prometheus to get trigger an alert when node is in unschedulable state kubernetes kubernetes

Prometheus to get trigger an alert when node is in unschedulable state


If you use prometheus-operator, kube-state-metrics return kube_node_status_condition metric:

sum(kube_node_status_condition{condition="Ready",status!="true"})


The above answer would show if a node it ready or not - a node can be ready but unschedulable (an example would be if you cordoned a node with:

kubectl cordon NODE)

Below example should cover a ready node that is unschedulable and is also available via kube-state-metrics

sum(kube_node_spec_unschedulable) by (node)


I'm referencing the machine_cpu_cores metric. It will only show nodes that are ready in a Kubernetes cluster.