Metrics Server — Lightweight Core Metrics for Kubernetes Autoscaling
Kubernetes Metrics Server is the lightweight cluster-wide CPU and memory metrics pipeline that powers kubectl top, HorizontalPodAutoscaler, and VerticalPodAutoscaler without requiring a full monitoring stack.
What it is
Kubernetes Metrics Server is a lightweight, cluster-wide aggregator of resource usage data. It collects CPU and memory metrics from kubelets and exposes them through the Kubernetes Metrics API. This API powers kubectl top, HorizontalPodAutoscaler (HPA), and VerticalPodAutoscaler (VPA) without requiring a full monitoring stack.
The tool targets cluster operators who need autoscaling and basic resource visibility without deploying Prometheus, Grafana, or other heavyweight monitoring solutions.
How it saves time or tokens
Metrics Server is a single deployment that replaces the need to configure a full monitoring pipeline just for autoscaling. Without it, kubectl top returns nothing and HPA cannot make scaling decisions. Installing it takes one command and provides immediate visibility into pod and node resource consumption. It stores only the latest data point in memory, so it adds minimal overhead to the cluster.
How to use
- Install Metrics Server with a single command:
kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml
- For development clusters with self-signed kubelet certificates:
kubectl patch deployment metrics-server -n kube-system \
--type='json' \
-p='[{"op": "add", "path": "/spec/template/spec/containers/0/args/-", "value": "--kubelet-insecure-tls"}]'
- Verify metrics are available:
kubectl top nodes
kubectl top pods -A
Example
# HPA that uses Metrics Server data
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: web-app-hpa
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: web-app
minReplicas: 2
maxReplicas: 10
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 70
- type: Resource
resource:
name: memory
target:
type: Utilization
averageUtilization: 80
Related on TokRepo
- DevOps tools directory -- Kubernetes management and infrastructure tools
- Monitoring tools -- Full observability stacks and metrics platforms
Common pitfalls
- On minikube and kind clusters, kubelet certificates are self-signed; Metrics Server fails to scrape without the
--kubelet-insecure-tlsflag - Metrics Server only stores the latest data point; it is not a replacement for Prometheus or other time-series databases for historical analysis
- HPA requires resource requests to be set on containers; without them, utilization percentages cannot be calculated and autoscaling silently fails
Frequently Asked Questions
No. Metrics Server provides only current CPU and memory data for autoscaling. It does not store historical data, support custom metrics, or provide alerting. Use Prometheus or similar for full monitoring. Metrics Server and Prometheus can run side by side.
This happens when Metrics Server is not installed or cannot scrape kubelets. Install Metrics Server and check its logs for TLS errors. On development clusters, add the --kubelet-insecure-tls flag to bypass certificate validation.
Metrics Server is designed to be lightweight. It stores only the latest data point in memory, not a time series. For a 100-node cluster, it typically uses less than 100MB of memory and minimal CPU. It scrapes kubelets every 15 seconds by default.
No. Metrics Server only provides CPU and memory resource metrics. For custom application metrics in HPA, use the custom metrics API backed by Prometheus Adapter, Datadog Cluster Agent, or similar custom metrics providers.
Yes. VerticalPodAutoscaler relies on the Metrics API to observe actual resource usage and recommend or apply resource request adjustments. Without Metrics Server or an equivalent provider, VPA cannot function.
Citations (3)
- Metrics Server GitHub— Metrics Server is the default metrics pipeline for Kubernetes autoscaling
- Kubernetes Metrics Server Docs— Powers HPA, VPA, and kubectl top
- Kubernetes Metrics API— Scrapes kubelet summary API for CPU and memory metrics
Related on TokRepo
Discussion
Related Assets
NAPI-RS — Build Node.js Native Addons in Rust
Write high-performance Node.js native modules in Rust with automatic TypeScript type generation and cross-platform prebuilt binaries.
Mamba — Fast Cross-Platform Package Manager
A drop-in conda replacement written in C++ that resolves environments in seconds instead of minutes.
Plasmo — The Browser Extension Framework
Build, test, and publish browser extensions for Chrome, Firefox, and Edge using React or Vue with hot-reload and automatic manifest generation.