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

Viewed 4658

Can someone help me in writing a promql query to get the node status whether node is schedulable or not. Thanks in advance.

3 Answers

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.

Related