We can have one metrics server per Kubernetes cluster. It retrieves metrices from each of the kubernetes nodes and pods, aggregates them and store them in memory. Metrics server is only In-memory monitoring solution and does not store the metrics on the disk. And hence historical performance data cannot be seen.
The Kubelet contains a sub-module called cAdvisor(container advisor). cAdvisor is resposible for retrieving metrics from pods and exposing them over kubelet-api to be available to the metrics server.
//cpu and memory consumption of each of the node
kubectl top node
//cpu and memory consumption of each pod
kubectl top pod
Installing metrics server git clone https://github.com/kodekloudhub/kubernetes-metrics-server.git
Run the kubectl create -f . command from within the downloaded repository.