tezvyn:

kube-state-metrics versus node-exporter

AI-drafted, machine-checkedSource: interviewbeginner
WHAT IT TESTS

Distinguishing object-state from host metrics.

OUTLINE

kube-state-metrics exposes API object state (deployment replicas, pod phase, restarts) from the control plane, while node-exporter exposes OS-level hardware metrics (CPU, memory, disk) per…

WHAT THIS TESTS This checks that you understand the two distinct metric sources in a Kubernetes Prometheus stack: object state versus host resource usage, which beginners often blur.

A GOOD ANSWER COVERS kube-state-metrics is a service that listens to the Kubernetes API server and generates metrics about the state of API objects. It tells you things like how many replicas a Deployment desires versus how many are available, what phase each pod is in, how many times a container has restarted, whether a Job succeeded, and resource requests and limits as declared. Importantly it reports declared state and counts, not actual consumption; it does not measure CPU cycles burned. node-exporter is a separate agent run as a DaemonSet, one per node, that exposes machine-level metrics from the host operating system: CPU utilization, memory usage, disk space and I/O, filesystem, and network statistics. So kube-state-metrics answers is my cluster in the shape I declared, and node-exporter answers how loaded are my machines. Together with the kubelet's cAdvisor, which provides per-container resource usage, they give a full picture.

COMMON WRONG ANSWERS Saying kube-state-metrics reports CPU or memory usage is the classic mistake; that comes from cAdvisor or node-exporter. Thinking node-exporter knows about pods or deployments is wrong; it only sees the host. Confusing kube-state-metrics with metrics-server, which feeds the HPA.

LIKELY FOLLOW-UPS Where actual container CPU/memory usage comes from (cAdvisor). What metrics-server does differently. How alerts combine both sources.

ONE CONCRETE EXAMPLE To alert that a Deployment is under-replicated you query kube_deployment_status_replicas_available from kube-state-metrics. To alert that a node is low on memory you query node_memory_MemAvailable_bytes from node-exporter.

Read the original → github.com

Get five bites like this every day.

Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.