Skip to content

3.1 Monitor Cluster Components (Metrics Server)

Kubernetes does not ship with a full monitoring stack by default, but it provides a resource metrics pipeline that lets you quickly check CPU and memory usage of nodes and pods using Metrics Server.


🎯 What You Monitor in a Kubernetes Cluster

At a minimum, you should be able to see:

  • Number of nodes
  • Node health status
  • Node CPU & memory usage
  • Pod CPU & memory usage
  • Which workloads are consuming resources

Note

Built‑in metrics are current usage only. Historical graphs require tools like Prometheus or commercial monitoring platforms.


🧩 Monitoring Tool Options

Common solutions:

  • Metrics Server β†’ lightweight, real‑time usage
  • Prometheus β†’ full metrics + history
  • Elastic Stack β†’ logs + metrics
  • Datadog / Dynatrace β†’ managed monitoring

Tip

For CKA/CKAD exams and quick troubleshooting, Metrics Server + kubectl top is what you must know.


πŸ“¦ What is Metrics Server

Metrics Server is a cluster add‑on that:

  • Collects CPU & memory metrics
  • Reads metrics from kubelets
  • Aggregates node & pod usage
  • Stores data in memory only
  • Powers kubectl top commands

Warning

Metrics Server is not for long‑term storage or dashboards.


βš™οΈ How Metrics Are Collected

Metrics flow inside the cluster like this:

Pods β†’ cAdvisor β†’ kubelet β†’ Metrics Server β†’ kubectl top

Step by step:

  1. Containers generate usage data
  2. cAdvisor inside kubelet reads container stats
  3. kubelet exposes metrics API
  4. Metrics Server pulls metrics
  5. kubectl top displays results

Abstract

kubelet + cAdvisor = metric source, Metrics Server = metric aggregator.


User commands:

kubectl top node
kubectl top pod

These commands query Metrics Server β€” not kubelet directly.


πŸš€ Install Metrics Server

minikube addons enable metrics-server

Success

Fastest method for local clusters.

git clone https://github.com/kubernetes-sigs/metrics-server.git
kubectl apply -f metrics-server/manifests/

This deploys:

  • Deployment
  • Service
  • RBAC roles
  • ClusterRoleBindings

Note

Wait 1–2 minutes for metrics to appear.


πŸ“Š View Node Metrics

kubectl top node

Example:

NAME     CPU(cores)   MEMORY(bytes)
node1    166m         1373Mi
node2    36m          1046Mi

Shows:

  • CPU in millicores
  • Memory usage
  • Current load

πŸ“Š View Pod Metrics

kubectl top pod

Example:

NAME    CPU(cores)   MEMORY(bytes)
nginx   12m          55Mi
redis   8m           40Mi

Example

Quickly identify high‑usage pods.


🧠 Exam Facts

Question

Does Metrics Server store history?

No β€” memory only.

Question

How many Metrics Servers per cluster?

Exactly one.


⚠️ If Metrics Are Missing

If you see:

metrics not available

Check:

  • Metrics Server pod running
  • Deployment healthy
  • Wait after install
  • kubelet TLS settings compatible

βœ… Quick Summary

Summary

  • Metrics Server gives live CPU/memory metrics
  • Uses kubelet + cAdvisor data
  • No historical storage
  • Enables kubectl top commands
  • Install via addon or manifests
  • Required knowledge for exams