The Metrics Server in Kubernetes is a lightweight aggregator for resource usage metrics like CPU and memory.
Important
The metrics server doesn’t store anything, it only provides a real-time snapshot of resource usage (CPU and memory) by collecting data from the Kubelet’s
/metrics/resourceendpoint on each node. These metrics are kept in memory and are ephemeral, meaning they are discarded as soon as they are consumed.
It’s primarily used by Kubernetes features like the Horizontal Pod Autoscaler (HPA) and the kubectl top command, offering a simple way to retrieve current cluster resource usage.
Note
In a Kubernetes environment you typically would use it together with Prometheus that is a full-fledged monitoring and alerting toolkit, that performs historical data collection, complex querying and alerting rools