Skip to main content
In this lesson we’ll cover how to monitor a Kubernetes cluster: what to monitor, common monitoring solutions, how metrics are produced, and how to deploy and query live metrics with Metrics Server. Why monitor Kubernetes?
  • Detect node failures and resource exhaustion early
  • Understand pod-level resource usage for troubleshooting and sizing
  • Drive autoscaling decisions (HPA/VPA)
  • Retain historical metrics when performing capacity planning or trend analysis

What to monitor

Monitoring solutions overview

Kubernetes does not include a full-featured monitoring system out of the box. Common open-source and commercial solutions include:
  • Metrics Server — lightweight metrics source used by kubectl top and autoscalers
  • Prometheus — long-term time series storage, alerting and advanced querying
  • EFK/ELK Stack — logging and log-based insights
  • Commercial SaaS — Datadog, Dynatrace, etc.
An infographic titled "Monitor" showing monitoring solutions (Metrics Server, Prometheus, Elastic Stack, Datadog, Dynatrace) as icons across the top. Below are three colored heatmap-style grids representing CPU, memory and disk metrics with small container/node icons.
Note: older architectures may mention Heapster — it is deprecated and replaced by Metrics Server. Heapster was one of the original projects that provided monitoring and analysis features for Kubernetes. You will still see many references to Heapster in older monitoring architectures, but Heapster is deprecated.
A slide titled "Heapster vs Metrics Server" with two icons: Heapster on the left (marked with a pink "Deprecated" label) and Metrics Server on the right. The slide has a dark blue background.

Metrics Server — lightweight cluster metrics

Metrics Server is the modern, lightweight replacement for Heapster. It provides the Kubernetes Metrics API used by kubectl top and autoscalers (Horizontal Pod Autoscaler). Key facts about Metrics Server:
  • Typically one Metrics Server instance per cluster.
  • Scrapes metrics from each node’s kubelet Summary API (which surfaces cAdvisor stats).
  • Aggregates metrics in memory and serves them via the Kubernetes metrics API.
  • Does not persist metrics to disk or provide long-term historical storage — for that use Prometheus or another time-series store.
Metrics Server provides live metrics for kubectl and autoscalers, but it is not a long-term metrics store. Use Prometheus or a dedicated monitoring stack for historical metrics and advanced queries.

How pod and node metrics are produced

  • Each node runs a kubelet that manages pods and communicates with the control plane.
  • The kubelet exposes node and container statistics (cAdvisor functionality) through the Summary API and other endpoints.
  • Metrics Server polls the kubelet Summary API on each node to collect node- and pod-level metrics and exposes them via the Kubernetes Metrics API.
A simple Kubernetes diagram showing a Metrics Server at the top and a cAdvisor/Kubelet component running on a node depicted as stacked colorful container tiles.

Deploying Metrics Server

Minikube:
Other environments:
  1. Clone or download the Metrics Server repository:
  1. Apply the upstream manifests (path may change; check the repo for the current location):
Allow a short period for Metrics Server to start scraping node and pod metrics after deployment.

Viewing live metrics

Use kubectl top to query live metrics from Metrics Server. Commands: Example:
Troubleshooting tips:
  • If kubectl top shows no data, confirm Metrics Server pods are running and check their logs (kubectl -n kube-system get pods and kubectl logs ...).
  • Ensure kubelet Summary API endpoints are reachable from the Metrics Server (network policies, firewalls, or RBAC can block access).
  • Metrics Server does not store historical data—if you need historical metrics, integrate Prometheus or another TSDB.

When to use Prometheus or a full monitoring stack

If you require:
  • Long-term historical metrics and retention
  • Advanced querying with PromQL or complex dashboards
  • Alerting and recording rules
  • Integration with Grafana or log/trace correlation
Then add Prometheus (and optionally a logging stack like EFK) to your observability architecture. Practice viewing cluster performance metrics and integrating a long-term solution like Prometheus when you need historical data and advanced analytics.

Watch Video

Practice Lab