Metrics Server in Kubernetes: How the Cluster Knows What Its Pods Are Using

Metrics Server in Kubernetes: How the Cluster Knows What Its Pods Are Using

Understand what the Metrics Server is, how it collects CPU and memory usage from every node, how it powers kubectl top and autoscaling, what it deliberately does not do, and how to install, secure, and troubleshoot it with confidence.

Picture the dashboard of a car. It shows your speed and how much fuel is left right now. It does not show a detailed diary of every trip you took last year, and it does not tell you why the engine wore down. But it gives the driver, and the car’s cruise control, the live numbers needed to make quick decisions. The Metrics Server is the dashboard of a Kubernetes cluster. It reports how much processor power and memory each node and pod is using at this moment, so that people and automatic systems can decide whether to add more pods, remove some, or investigate a busy machine.

1Why a Cluster Needs to Know Its Own Usage

Decisions about capacity need live numbers.

A Kubernetes cluster runs many pods across many nodes, and demand on those pods changes constantly. A shop’s website is quiet at three in the morning and overwhelmed during a sale. If the cluster does not know how busy each pod is, it cannot add more copies when they are needed or remove them when they are wasteful. Someone would have to watch graphs all day and adjust by hand.

Knowing usage is also important for people. An engineer who wants to find out which pod is eating all the memory on a node needs a quick answer, not a long investigation. A capacity planner wants to see whether nodes are close to full. These questions all need the same basic ingredient: current CPU and memory usage for nodes and pods, available from one central place with a standard way to ask for it.

Simple Analogy

Think of a busy restaurant with several kitchens. The manager needs to know which kitchens are overloaded right now so she can send extra cooks. She does not need last month’s report at that moment; she needs a quick, current headcount from each kitchen. The Metrics Server is the person who walks around every few seconds, counts the load in each kitchen, and posts the numbers on one board.

What problem this feature solves

Before a standard mechanism existed, every tool that needed usage numbers had to gather them on its own, in its own way. That was wasteful, inconsistent, and hard to secure. The Metrics Server provides one shared, standard source for basic resource usage, exposed through the normal Kubernetes API, so that every tool that needs the numbers asks the same place.

2
Resource types reported: CPU and memory
15s
Typical default interval between collections
Now
It reports current values, not history
i
Good to know

This guide assumes you know what a pod and a node are, but every new term is explained when it first appears. We will spend as much time on what the Metrics Server does not do as on what it does, because that difference causes most of the confusion.

2What Is the Metrics Server?

A small cluster add-on that gathers CPU and memory usage and serves it through the Kubernetes API.

The Metrics Server is a lightweight component that you run inside your cluster, usually as a single Deployment in the system namespace. Its job is narrow and clear. It periodically asks every node’s agent for the current CPU and memory usage of the node and of every container running there. It keeps the latest values in memory and makes them available through a standard endpoint of the Kubernetes API, so that any authorised client can read them.

It is important to understand what it is not. It is not a monitoring system. It does not store history, draw graphs, or send alerts. It only knows the most recent readings, and when it restarts, even those are gone until the next collection. It is designed to feed autoscalers and quick command-line checks, not to replace a full monitoring stack.

Does

Collects current usage

Gathers CPU and memory usage for every node and every pod on a regular schedule.

Does

Serves it through the API

Publishes the numbers through the standard Metrics API, so tools use the normal, authenticated Kubernetes interface.

Does

Feeds autoscaling

Provides the data that the Horizontal Pod Autoscaler and similar tools use to change the number or size of pods.

Does not

Store history

It keeps only the latest readings in memory. Trends over hours or days require a separate monitoring system.

Does not

Report everything

It covers CPU and memory only. It does not report disk, network, or the internal metrics of your applications.

Does not

Raise alerts

It has no notion of thresholds, dashboards, or notifications. Other tools build those on top of richer data.

!
Common Misconception

Many beginners install the Metrics Server expecting graphs and alerts. It provides neither. If you need to see last week’s memory trend or to be paged when a node runs hot, you need a monitoring solution in addition to, not instead of, the Metrics Server.

3Two Pipelines: Resource Metrics and Full Metrics

Kubernetes distinguishes a small built-in pipeline from a rich, optional one.

Kubernetes describes two different ways of collecting metrics. The resource metrics pipeline is the small, standard one. It carries only basic CPU and memory usage, and it exists to power core cluster features such as autoscaling and quick usage checks. The Metrics Server is the standard component of this pipeline.

The full metrics pipeline is the larger, optional one. It collects far more data, from nodes, containers, the Kubernetes objects themselves, and your applications, and it stores it over time. Tools such as Prometheus and its ecosystem belong here. This pipeline can also feed additional metrics back into Kubernetes, so that autoscalers can react to things like the number of requests per second rather than only CPU.

flowchart TD
    subgraph Resource metrics pipeline
        K1[Kubelet on each node] --> MS[Metrics Server
latest CPU and memory] MS --> API1[Metrics API] API1 --> HPA[Autoscalers] API1 --> TOP[kubectl top] end subgraph Full metrics pipeline K2[Kubelets, apps, cluster objects] --> COL[Collector and long-term storage] COL --> DASH[Dashboards and alerts] COL --> ADP[Adapter exposing custom metrics] ADP --> HPA end
FIG 1 — The small resource pipeline serves core features, and the full pipeline adds history, alerts, and custom metrics
AspectResource Metrics PipelineFull Metrics Pipeline
Main componentMetrics ServerMonitoring stack such as Prometheus with exporters
Data collectedCPU and memory onlyAlmost anything, including network, disk, and application metrics
HistoryNone, latest values onlyLong-term storage and querying
PurposeAutoscaling and quick checksMonitoring, alerting, capacity planning, and debugging
WeightVery lightHeavier, needs storage and care
Required for autoscaling on CPUYes, in the standard setupNot for basic CPU, but needed for custom metrics
Simple Analogy

The resource pipeline is the speedometer and fuel gauge on a dashboard: small, essential, always current. The full pipeline is the car’s data recorder and diagnostics computer, which stores everything and lets a mechanic study it later. Both are useful, and they do different jobs.

4Where the Numbers Come From

From the container runtime, through the kubelet, to the Metrics Server.

The Metrics Server does not measure anything itself. It relies on a chain of components that already exist on every node. At the bottom, the container runtime and an embedded monitoring library track how much CPU and memory each container uses. The kubelet, the agent that runs on every node and manages its pods, collects these figures and exposes them through a small endpoint. The Metrics Server visits every kubelet on a schedule, reads that endpoint, and gathers the results into one cluster-wide picture.

sequenceDiagram
    participant C as Containers
    participant R as Runtime stats
    participant K as Kubelet on each node
    participant M as Metrics Server
    participant A as Kubernetes API Server
    participant U as Client such as autoscaler
    C->>R: Use CPU and memory
    R->>K: Provide usage statistics
    loop Every collection interval
        M->>K: Request resource metrics
        K-->>M: Node and pod usage
    end
    M->>M: Keep latest values in memory
    U->>A: Ask for pod metrics
    A->>M: Forward request through the aggregation layer
    M-->>A: Latest values
    A-->>U: Response
        
FIG 2 — The Metrics Server pulls from every kubelet and answers API requests from memory
1

Containers do their work

Each running container consumes processor time and memory. The operating system and runtime keep counters of both.

2

The kubelet gathers the counters

The node agent reads the statistics for every container and for the node as a whole and offers them at a dedicated resource-metrics endpoint.

3

The Metrics Server scrapes each kubelet

On a regular interval, by default around fifteen seconds, it contacts every node and reads the current figures over a secure connection.

4

Values are kept in memory

The latest readings replace the previous ones. Nothing is written to disk, which keeps the component simple and fast.

5

Clients read through the API

Anyone allowed to ask, such as an autoscaler or a person, receives the values through the standard Kubernetes API.

Simple Analogy

Imagine a regional manager who phones every branch shop every fifteen seconds and asks how many customers are inside. Each shop manager counts the customers using their own turnstile. The regional manager writes the latest numbers on one whiteboard and erases the old ones. Anyone can walk in and read the board, but nobody keeps the erased numbers.

5The Metrics API and the Aggregation Layer

The Metrics Server extends the Kubernetes API instead of inventing a new interface.

The Kubernetes API server is the single front door of the cluster. Everything, from creating pods to reading their status, goes through it, with the same authentication and permission checks. The Metrics Server plugs into this front door using a feature called the aggregation layer. It registers itself as an extra API service, under a standard group name reserved for resource metrics. When a client asks the main API server for metrics, the request is transparently forwarded to the Metrics Server, and the answer comes back through the same door.

Term 1

Aggregation layer

A feature of the API server that lets extra servers add their own API groups, which appear to clients as if they were built into Kubernetes.

Term 2

API service registration

An object that tells the API server which group and version to forward, and which in-cluster service should receive those requests.

Term 3

Metrics API

The standard interface for resource metrics. It offers two views: usage of nodes, and usage of pods.

Term 4

Available condition

The registration reports whether the backing server is reachable. If it is not available, every request for metrics fails.

flowchart LR
    C[Client
autoscaler or person] --> API[Kubernetes API Server] API -->|resource metrics group| AGG[Aggregation layer] AGG --> SVC[Metrics Server service] SVC --> MS[Metrics Server pod] API -->|everything else| ETCD[Built-in API and storage]
FIG 3 — Requests for metrics are forwarded to the Metrics Server; all other requests are handled normally
Simple Analogy

Think of a hotel switchboard. Guests dial one number for everything. Calls about the spa are quietly transferred to the spa desk, and the guest never needs to know a separate number. The API server is the switchboard, and the Metrics Server is the spa desk that handles metrics calls.

i
Practical Tip

The health of the API service registration is the first thing to check when metrics are missing. If it reports that it is not available, the problem is between the API server and the Metrics Server, not in the autoscaler or the command-line tool.

6What the Numbers Actually Mean

Reading a usage figure correctly avoids many wrong conclusions.

The Metrics API reports two measurements for every node and every container: CPU and memory. Each comes with a timestamp, and a window that says over what period the figure was calculated. Understanding how each is measured explains why the numbers sometimes look different from what other tools show.

MeasurementHow It Is MeasuredUnitsPoints to Remember
CPUThe average rate of processor use over the window between two readingsCores or fractions of a core, often written as thousandths, called millicores, or even finerIt is a rate, not a total. It needs at least two readings to compute
MemoryThe working set, meaning memory that is in active use and cannot easily be reclaimedBytes, shown as kibibytes or mebibytesIt is a snapshot at the moment of reading, and it is close to what the system considers when it decides to reclaim memory
TimestampThe moment the reading was takenDate and timeTells you how fresh the number is
WindowThe length of time over which CPU was averagedSecondsShort windows make CPU numbers jumpy
Simple Analogy

CPU is like the speed of a car, calculated from how far it travelled between two moments. Memory is like the amount of luggage currently in the boot. Speed needs two readings to calculate, while luggage is simply counted whenever you look.

Why numbers differ between tools

People often compare the figures from the Metrics Server with figures from a monitoring system or from tools on the node, and find small differences. There are good reasons. Different tools may sample at different moments, average over different windows, or count memory differently, for example including or excluding cached file data. The Metrics Server deliberately reports the working set because it is what matters for decisions about running out of memory.

!
Common Mistake

Treating a single reading as the truth about a pod. CPU use is bursty, and a fifteen-second average can hide short spikes. Use the Metrics Server for a general picture and for autoscaling, and use a monitoring system with history when you need to study spikes.

“The Metrics Server tells you how busy the cluster is right now, not how busy it was.”

7Who Uses the Metrics Server

A handful of important clients rely on its numbers.

Client 1

kubectl top

The command-line tool shows current CPU and memory of nodes and pods in a simple table. It is the quickest way to find the busiest pod or node.

Client 2

Horizontal Pod Autoscaler

Changes the number of pods based on their CPU or memory use compared with what each pod requested.

Client 3

Vertical Pod Autoscaler

Recommends or applies better resource requests for pods, using usage observed over time along with current readings.

Client 4

Dashboards and tools

Some web consoles and cluster tools read the Metrics API to show quick usage information without needing a full monitoring stack.

Client 5

Your own automation

Scripts and controllers can call the Metrics API like any other Kubernetes API to make simple decisions about capacity.

flowchart TD
    MS[Metrics Server] --> API[Metrics API]
    API --> TOP[kubectl top
people checking usage] API --> HPA[Horizontal Pod Autoscaler
more or fewer pods] API --> VPA[Vertical Pod Autoscaler
better requests] API --> TOOLS[Dashboards and scripts]
FIG 4 — Several tools share one source of resource usage
Simple Analogy

One shared electricity meter on the wall can be read by the building manager, the energy-saving robot, and the accountant. They all trust the same reading, and nobody installs a private meter.

i
Practical Tip

A quick way to check that the Metrics Server works is to run the command-line usage check for nodes. If it prints CPU and memory for every node, the whole pipeline from kubelet to API is working.

8How Autoscaling Uses the Metrics Server

The Horizontal Pod Autoscaler is the most important consumer, and it has specific expectations.

The Horizontal Pod Autoscaler, often called the HPA, adjusts how many copies of an application run. On a regular cycle, roughly every fifteen seconds, it asks the Metrics API for the current usage of the pods it manages. It compares that usage with a target you set, such as fifty percent of requested CPU, and calculates how many pods would bring usage close to the target. If more are needed, it scales up. If fewer would do, it scales down, though more cautiously.

sequenceDiagram
    participant H as Autoscaler
    participant A as Metrics API
    participant D as Deployment
    loop Every sync period
        H->>A: Current CPU use of my pods
        A-->>H: Usage values
        H->>H: Compare average use with target of requests
        alt Use above target
            H->>D: Increase replicas
        else Use below target
            H->>D: Decrease replicas after stabilisation
        end
    end
        
FIG 5 — The autoscaler repeatedly reads usage and adjusts the number of pods

Utilisation is relative to requests

The autoscaler does not compare usage with the size of the node or with limits. It compares usage with what each pod requested. If a pod requested half a core and is using a quarter of a core, its utilisation is fifty percent. This means that pods without resource requests cannot be autoscaled on utilisation. The autoscaler reports an error saying that it is missing a request, and shows the target as unknown.

SituationWhat the Autoscaler SeesResult
Pods use 80 percent of their request, target is 50 percentUsage well above targetScales up to spread the load
Pods use 20 percent of their request, target is 50 percentUsage well below targetScales down after a stabilisation period
Pods have no CPU requestCannot compute utilisationTarget shown as unknown and no scaling happens
Metrics Server is not availableNo data at allAutoscaler cannot act and reports failure to get metrics
New pods just startedTheir early usage may be unrepresentativeAutoscaler treats them carefully to avoid overreacting
Simple Analogy

Imagine a restaurant manager who calls in extra waiters when each current waiter is handling more than half their comfortable load. She measures load against what each waiter said they could handle, not against the size of the room. A waiter who never said what they could handle cannot be judged, so the manager cannot act.

!
Common Mistake

Setting up autoscaling on a workload that has no resource requests, and wondering why it never scales. Requests are the foundation of utilisation-based autoscaling, so define them realistically before enabling the autoscaler.

9Installing the Metrics Server and Its Requirements

It is easy to install, but several conditions must hold for it to work.

The Metrics Server is installed like any other cluster add-on, through a ready-made set of manifests or a package, which creates a Deployment, a Service, the permissions it needs, and the API service registration. Some managed Kubernetes platforms and local development tools include it already or provide a simple switch to enable it, while others require you to install it yourself. Check what your platform provides before installing a second copy.

RequirementWhy It Is NeededWhat Goes Wrong Without It
Aggregation layer enabled on the API serverLets the API server forward metrics requests to the add-onMetrics requests fail because nothing answers them
API server can reach the Metrics Server podRequests are forwarded over the cluster networkThe API service shows as unavailable
Metrics Server can reach every kubeletIt must contact each node to read its numbersSome or all nodes are missing from the results
Kubelets allow authenticated metrics requestsNodes only answer clients that are authorisedRequests are refused with authorisation errors
Trusted certificates on kubeletsThe Metrics Server verifies node identity over TLSCertificate errors block collection
Sensible resource requests on the Metrics ServerIt needs a little CPU and memory to run reliablyIt may be evicted or starved on busy nodes
1

Check whether it already exists

Look in the system namespace and at the registered API services. Many platforms include it, and a duplicate would conflict.

2

Install from the official manifests or package

Apply the published manifests or use the chart, choosing the high-availability variant for production.

3

Wait for the API service to become available

The registration should report available. If it does not, read its message before doing anything else.

4

Verify with a usage check

Ask for node usage. It may take a minute after installation for the first figures to appear, because at least one collection cycle must complete.

5

Test an autoscaler

Create a test autoscaler on a workload with requests and confirm that it shows real numbers instead of unknown.

i
Patience After Installing

Right after installation, commands may report that metrics are not yet available. This is normal. CPU needs two readings to compute a rate, so wait a minute or two before assuming something is broken.

10Kubelet Certificates and the Insecure Option

The most common installation problem is about trust between the Metrics Server and the nodes.

When the Metrics Server contacts a kubelet, it uses an encrypted connection and checks the kubelet’s certificate, just as your browser checks a website’s certificate. In some clusters, especially local test clusters and some self-built ones, the kubelets use self-signed certificates, or certificates that do not list the address the Metrics Server uses to reach them. The Metrics Server then refuses to trust them, and collection fails with certificate errors.

A very common quick fix found in tutorials is an option that tells the Metrics Server to skip certificate verification of kubelets. This makes the error disappear, and it is perfectly reasonable in a throwaway development cluster. In production, though, it removes an important protection. Without verification, the Metrics Server cannot be sure it is talking to a real node, and an attacker who can intercept traffic on the node network could impersonate one.

Skipping verification

  • Fixes certificate errors instantly
  • Handy for local and disposable clusters
  • Needs no changes to how nodes get certificates

Why not in production

  • Nodes can be impersonated without detection
  • Weakens the trust model of the cluster
  • Hides a certificate problem that deserves a real fix
  • May fail security reviews and compliance checks
flowchart TD
    A[Certificate error from kubelet] --> B{Production cluster?}
    B -->|No, disposable| C[Skipping verification is acceptable]
    B -->|Yes| D[Fix the real cause]
    D --> E[Issue kubelet serving certificates signed by the cluster authority]
    D --> F[Make sure certificates list the addresses used to reach nodes]
    D --> G[Choose the right preferred address type for the Metrics Server]
        
FIG 6 — In production, fix the certificate trust problem instead of switching verification off
Simple Analogy

A courier who refuses to deliver unless the recipient shows an identity card is annoying when the recipient has lost the card. Telling the courier to hand over packages to anyone who answers the door solves the annoyance and invites theft. The correct fix is to get the recipient a proper card.

i
Address Types

The Metrics Server can be told which kind of node address to try first, such as the internal address or the host name. Choosing the one that appears in the kubelet certificates, and that is reachable from the pod network, often resolves errors without weakening security.

11High Availability and Sizing

A single replica is fine for learning, but production autoscaling depends on it.

The Metrics Server is small, but a lot depends on it. If it is down, autoscalers cannot get data, and they stop scaling. Applications then stay at whatever size they had when the outage began, which can be dangerous during a traffic spike. For this reason, production clusters usually run more than one replica.

Practice 1

Run at least two replicas

Two replicas mean that one can be restarted or lost without interrupting metrics. The project provides a high-availability variant of its manifests for this purpose.

Practice 2

Spread replicas across nodes

Use anti-affinity or spread rules so both replicas do not land on the same node and fail together.

Practice 3

Protect with a disruption budget

A budget ensures that node maintenance never takes down all replicas at once.

Practice 4

Give it a high priority

Run it with a system-level priority so it is not the first to be evicted when a node is under pressure.

How big does it need to be?

The Metrics Server is designed to be light. As a rough rule from the project’s guidance, it needs on the order of a thousandth of a core of CPU and a couple of megabytes of memory for each node in the cluster. A cluster of a hundred nodes therefore needs only a modest amount, but requests should still be set so that the scheduler reserves room for it. Very large clusters, with thousands of nodes, need proportionally more and should follow the project’s sizing guidance closely.

2+
Replicas recommended for production
~1m
CPU per node, roughly
~2MB
Memory per node, roughly
!
Common Mistake

Running a single replica with no requests and no priority. When the node it sits on becomes busy, the Metrics Server is starved or evicted at exactly the moment autoscalers need it most.

12Collection Interval and How Fresh the Data Is

There is always a delay between something happening and the cluster reacting to it.

The Metrics Server collects data on a schedule, by default about every fifteen seconds. That means any figure you read may be up to that old. On top of this, autoscalers check the numbers on their own schedule, and then need time to start new pods. These delays add up, and understanding them explains why autoscaling is never instant.

sequenceDiagram
    participant L as Load spike
    participant K as Kubelet
    participant M as Metrics Server
    participant H as Autoscaler
    participant S as Scheduler and nodes
    L->>K: Usage rises
    Note over K,M: Wait for next collection, up to the interval
    M->>K: Scrape
    K-->>M: New usage
    Note over M,H: Wait for next autoscaler check
    H->>M: Read usage
    H->>S: Ask for more pods
    Note over S: Pods are scheduled, images pulled, containers start, readiness passes
    S-->>L: New capacity begins to serve traffic
        
FIG 7 — Each step adds delay between a load spike and new capacity
StepTypical DelayHow to Reduce It
Metrics collection intervalUp to the configured interval, by default around fifteen secondsLower the interval carefully, within the supported minimum
Autoscaler check periodAround fifteen seconds by defaultUsually left alone, changed only at the cluster level
Pod scheduling and start-upSeconds to minutesKeep images small and start-up fast
Readiness and warm-upDepends on the applicationTune probes and pre-warm caches
New node provisioning, if neededMinutesKeep some spare capacity in the cluster
Simple Analogy

A restaurant manager checks the queue at the door every fifteen seconds, then phones a temp agency, and the extra waiter needs time to arrive and put on an apron. Even with a perfect manager, the queue grows for a while before help appears. Shortening any step helps, but none of them is zero.

i
Practical Tip

Do not rely on autoscaling alone for sudden, predictable spikes such as a scheduled sale. Scale up ahead of time, or keep a healthy minimum number of pods, and let autoscaling handle the unexpected variation on top.

13Metrics Server Versus Other Metrics Tools

Several tools have “metrics” in the name, and each answers a different question.

The Kubernetes ecosystem contains several components that produce or collect metrics, and beginners often mix them up. The differences are simple once you know what each looks at. Some measure the resources that containers consume. Some describe the state of Kubernetes objects. Some measure the machines themselves. And some store and analyse all of these over time.

ToolWhat It Looks AtKeeps HistoryMain Purpose
Metrics ServerCurrent CPU and memory of nodes and podsNoAutoscaling and quick usage checks
Kubelet resource endpointsUsage statistics of containers on one nodeNoSource of data for the Metrics Server and other collectors
State metrics exporterThe state of Kubernetes objects, such as how many replicas are readyOnly if scraped by a monitoring systemMonitoring the health of the cluster’s objects
Node exporterHardware and operating system metrics of each machineOnly if scraped by a monitoring systemMonitoring machines in depth
Monitoring system such as PrometheusWhatever is fed to it, from all of the above and from applicationsYesDashboards, alerts, and analysis
Custom metrics adapterTranslates external metrics into the Kubernetes metrics APIDepends on the sourceAutoscaling on things like requests per second or queue length
flowchart TD
    Q{What do you need?} -->|Autoscale on CPU or memory| MS[Metrics Server]
    Q -->|Quick look at current usage| MS
    Q -->|History, graphs, alerts| PR[Monitoring system]
    Q -->|Health of deployments and pods as objects| KS[State metrics exporter]
    Q -->|Machine level details| NE[Node exporter]
    Q -->|Autoscale on requests or queue length| AD[Custom metrics adapter]
        
FIG 8 — Pick the tool according to the question you want answered
Simple Analogy

In a hospital, the bedside monitor shows a patient’s heartbeat right now, which is the Metrics Server. The medical chart lists how many patients are in which ward, which is the state exporter. The engineer’s report on the building’s power supply is the node exporter. And the hospital’s records archive, which keeps everything for years, is the monitoring system.

i
They Work Together

Most production clusters run the Metrics Server alongside a full monitoring stack. The first serves autoscalers with a simple, standard interface. The second serves people with history, graphs, and alerts.

14Limitations You Should Know

Being small and simple means that some things are simply out of scope.

No history

Only the latest values are kept, in memory. A restart clears them until the next collection. You cannot ask what usage was an hour ago.

Only CPU and memory

Network traffic, disk activity, and application-specific figures are not available. Autoscaling on such signals needs a custom metrics source.

Not for precise monitoring

The figures are averaged over short windows and are not intended as exact accounting. Do not use them for billing or strict capacity guarantees.

Short-lived pods may be missed

A pod that starts, runs, and finishes between two collections may never appear. Very short jobs are invisible to this tool.

No alerting or dashboards

It exposes data through the API only. Anything visual or proactive must be built with other tools.

Depends on kubelet health

If a node’s agent is unreachable or unhealthy, that node’s numbers are missing, and any autoscaler that relies on them may have gaps in its view.

!
Plan Around the Limits

Treat the Metrics Server as a fast, simple signal for automated decisions, and pair it with a monitoring system for everything else. Expecting more from it leads to disappointment and false conclusions.

15When to Use the Metrics Server

Situations where it is exactly the right tool.

Autoscaling web services on CPU

A web application whose load rises and falls with traffic scales its number of pods on CPU utilisation. The Metrics Server supplies the numbers with no extra software.

Quick troubleshooting

When a node feels slow, a single command shows which pods use the most CPU or memory, narrowing the search in seconds.

Right-sizing resource requests

Comparing actual usage with requests reveals pods that request far more than they use, which wastes capacity, or far less, which risks instability.

Small clusters and development environments

Where a full monitoring stack would be overkill, the Metrics Server gives enough insight to work comfortably and to try autoscaling.

Foundation for vertical scaling

Tools that adjust the size of each pod use current readings as part of their recommendations, so the Metrics Server is a natural companion.

i
Rule of Thumb

If a Kubernetes feature or a command needs current CPU or memory use, the Metrics Server is probably the component providing it. If you find yourself asking about last Tuesday, you need something else.

16Requests and Limits: The Foundation of Good Metrics Use

Metrics only make sense when compared with what each pod asked for.

Every container can declare a request, the amount of CPU and memory the scheduler should reserve for it, and a limit, the most it is allowed to use. These two numbers give meaning to the usage figures from the Metrics Server. Usage of a quarter of a core means one thing for a pod that requested half a core and something quite different for one that requested a tenth.

Term 1

Request

The amount the scheduler sets aside for the container. It decides where a pod can be placed and is the base for autoscaler utilisation.

Term 2

Limit

The ceiling on usage. CPU above the limit is throttled, and memory above the limit can lead to the container being stopped.

Term 3

Utilisation

Usage divided by request, expressed as a percentage. It is the number the autoscaler compares with its target.

Observation from MetricsWhat It SuggestsPossible Action
Usage far below request for a long timeRequest is too generous and wastes capacityLower the request
Usage regularly above requestRequest is too low; the pod may be squeezed on a busy nodeRaise the request
CPU usage sits at the limitThe container is being throttledRaise the limit or add pods
Memory usage close to the limitRisk of being stopped for using too much memoryRaise the limit or fix a leak
Wildly varying usageBursty workloadChoose autoscaling targets with headroom
Simple Analogy

Booking a table at a restaurant is a request: you tell the restaurant how many seats you need. The fire limit of the room is the limit. If you book ten seats and only two people show up, the table is wasted. If you book two and eight arrive, everyone is squeezed. Watching how many actually come, which is what the Metrics Server does, tells you how to book next time.

!
Common Mistake

Copying request values from another application or from an example, without ever checking real usage. Compare actual readings with the requests regularly, and adjust them to match reality.

17Performance and Scale Considerations

Small by design, but not free at very large scale.

The Metrics Server does one thing, and does it efficiently: it contacts every node on a schedule and keeps the results in memory. Because it stores nothing on disk and computes nothing complicated, it uses very few resources, and it is designed to support clusters of thousands of nodes. Its costs grow with the number of nodes and pods, since it must contact each node and hold its readings, and with how often it does so.

Advantages

  • Very low resource use per node
  • No storage to manage or back up
  • Scales to large clusters when sized properly
  • Uses the standard API, so no special clients are needed

Disadvantages / Trade-offs

  • Load on kubelets grows as the interval gets shorter
  • Memory use grows with nodes and pods
  • A restart loses all readings until the next cycle
  • A single point of dependency for autoscaling
Tip 1

Do not shorten the interval without need

More frequent collection adds load to every node, and the benefit is small because autoscalers check on their own schedule.

Tip 2

Set requests that match cluster size

Follow the sizing guidance so the Metrics Server never runs short of CPU or memory as the cluster grows.

Tip 3

Watch its own health

Because so much depends on it, monitor the Metrics Server as you would any other critical component.

18Security Considerations

Resource usage looks harmless, but access still needs to be controlled.

The Metrics Server talks to every node and serves information about every pod, so it touches several security boundaries. It must be authorised to read from kubelets, it must prove its identity to the API server, and clients who read metrics must be permitted to do so. Each of these connections should be locked down according to the principle of giving only the permissions that are needed.

Permissions to read from kubelets

The Metrics Server is granted a narrow role that lets it read node metrics. Do not replace it with broad administrator access, and review what the installation manifests grant.

Encrypted and verified connections

Keep verification of kubelet certificates on in production, and use certificates signed by the cluster authority, so the Metrics Server can trust the nodes it visits.

Who can read metrics

Reading pod metrics is a permission like any other. Grant it to the people and tools that need it, such as autoscalers, and consider restricting it in shared clusters, since usage patterns can reveal what a team is running.

Network access

Allow the API server to reach the Metrics Server and the Metrics Server to reach the node agents, and use network policies to block other paths that are not needed.

Run it with minimal privileges

The official manifests run it as a non-root user with a read-only file system. Keep these settings when you customise the installation.

Keep it up to date

As a component that is trusted by the API server and node agents, it should be upgraded with security fixes, and its images should come from a trusted source.

!
Do Not Weaken Trust Casually

Switching off certificate verification, or granting cluster-wide administrator rights, to make an installation work is a shortcut that leaves the cluster less safe long after the original problem is forgotten.

19Troubleshooting the Metrics Server

Most problems fall into three groups: the API service, the connection to nodes, and the data itself.

When metrics do not appear, the cause almost always lies in one of three places. Either the API server cannot reach the Metrics Server, or the Metrics Server cannot collect from the nodes, or the data is there but incomplete for a reason that is easy to explain. Working through the chain in order finds the problem quickly, because each link can be checked on its own.

1

Check the API service registration

Look at whether the metrics API service is reported as available. If not, the message explains whether the backing service has no endpoints or whether discovery failed.

2

Check the Metrics Server pods

Confirm the pods are running and ready. A pod that never becomes ready usually has an error in its logs about reaching nodes or verifying certificates.

3

Read the logs

The logs list which nodes could not be scraped and why, such as certificate name mismatches, timeouts, or authorisation failures.

4

Test network paths

Confirm the API server can reach the Metrics Server pod, and the Metrics Server can reach the kubelet port on each node. Firewalls and security groups are frequent culprits.

5

Ask for node and pod usage

See whether all nodes appear, and whether pods show numbers. Missing nodes point at node-level connection issues.

6

Inspect the autoscaler

If usage commands work but the autoscaler shows unknown, look for missing resource requests or pods that are not yet ready.

SymptomLikely CauseWhat To Do
Usage command reports metrics not availableJust installed, no data collected yet, or API service unavailableWait a minute, then check the API service status
API service reports missing endpointsMetrics Server pod not running or not readyInspect the deployment and pod events
API service fails discovery checksAPI server cannot reach the pod over the networkCheck network policies, firewalls, and host network settings
Certificate errors about node addressesKubelet certificates do not include the address usedFix certificates or change the preferred address type
Timeouts scraping nodesNode port blocked or node unreachableOpen the kubelet port between the Metrics Server and nodes
Authorisation errors from kubeletsMissing permission to read node metricsCheck the role and binding created by the installation
Some nodes missingNode unhealthy or unreachableCheck node status and connectivity
Autoscaler shows unknown targetsMissing resource requests or metrics not yet availableDefine requests and confirm metrics for those pods
i
Start From the Front

If the usage command fails, start with the API service, because a failure there hides everything behind it. If it works for nodes but not for a particular pod, the pod is probably too new or short-lived to have been collected yet.

20Monitoring the Metrics Server Itself

The component that watches everything needs somebody watching it.

Because autoscaling depends on the Metrics Server, its failure is easy to overlook and costly. If it silently stops, autoscalers freeze at their current size. A well-run cluster therefore monitors the Metrics Server just as carefully as it monitors the applications it helps to scale.

Signal 1

API service availability

Alert if the metrics API service stops reporting as available. This is the clearest sign that autoscalers are blind.

Signal 2

Pod readiness and restarts

Watch for replicas that are not ready or that restart repeatedly, which often indicates resource starvation or repeated errors.

Signal 3

Scrape errors and duration

The component exposes its own metrics about how many scrapes fail and how long they take. Rising failures or duration warn of node connection problems.

Signal 4

Number of nodes reporting

Compare the number of nodes with metrics against the number of nodes in the cluster. A gap means some nodes are invisible.

Signal 5

Autoscaler health

Alert when autoscalers report that they cannot fetch metrics or show unknown targets for long periods.

flowchart TD
    W[Monitoring system] --> A1[Alert: API service unavailable]
    W --> A2[Alert: Metrics Server not ready]
    W --> A3[Alert: scrape failures rising]
    W --> A4[Alert: nodes missing from metrics]
    W --> A5[Alert: autoscaler cannot fetch metrics]
    A1 --> R[On-call engineer investigates the chain]
    A2 --> R
    A3 --> R
    A4 --> R
    A5 --> R
        
FIG 9 — Several alerts cover the different ways the metrics pipeline can fail
!
Silent Failure

An autoscaler that cannot read metrics does not raise an obvious alarm; it just stops scaling. Without alerts on the metrics pipeline, you may discover the failure only when a traffic spike overwhelms a fixed-size application.

21Design Patterns with the Metrics Server

Habits that make autoscaling and usage checks dependable.

Pattern: Requests first, autoscaling second

Set realistic requests on every workload before turning on autoscaling. Utilisation targets only make sense against sensible requests.

Pattern: Minimum replicas with headroom

Keep a minimum number of pods that covers expected baseline load, and a maximum that fits the cluster, so autoscaling handles variation without starting from zero.

Pattern: Metrics Server plus monitoring stack

Run both. The Metrics Server serves autoscalers, and the monitoring system serves people with history, graphs, and alerts.

Pattern: Regular right-sizing reviews

Periodically compare current usage with requests and adjust them, so scheduling and autoscaling reflect reality.

Pattern: High-availability installation

Run at least two replicas, spread across nodes, with a disruption budget and a system priority, so autoscaling survives maintenance and node failures.

Pattern: Scale on the right signal

Use CPU or memory from the Metrics Server for compute-bound workloads, and add a custom metrics source for workloads whose load is better measured by requests or queue length.

flowchart TD
    A[Define requests and limits] --> B[Install Metrics Server in high availability]
    B --> C[Create autoscaler with sensible min and max]
    C --> D[Monitor autoscaler and metrics health]
    D --> E[Review usage against requests regularly]
    E --> A
        
FIG 10 — A healthy loop of requests, metrics, autoscaling, and review

22Anti-patterns to Avoid

Habits that lead to broken autoscaling and false confidence.

ANTI-PATTERN-01 Avoid
Problem

Using the Metrics Server as the monitoring system.

Why It’s Harmful

It keeps no history, offers no alerts, and reports only two resources, so incidents cannot be studied and problems go unnoticed.

Correct Approach

Add a monitoring stack for history and alerts, and keep the Metrics Server for autoscaling and quick checks.

ANTI-PATTERN-02 Avoid
Problem

Enabling autoscaling on workloads with no resource requests.

Why It’s Harmful

Utilisation cannot be computed, so the autoscaler shows unknown targets and never scales.

Correct Approach

Set realistic requests first, and verify that the autoscaler shows real percentages.

ANTI-PATTERN-03 Avoid
Problem

Turning off kubelet certificate verification in production to make the installation work.

Why It’s Harmful

It removes protection against impersonated nodes and hides a certificate problem that should be fixed.

Correct Approach

Fix the certificates or the address type, and keep verification on.

ANTI-PATTERN-04 Avoid
Problem

Running a single replica without requests or priority.

Why It’s Harmful

The component can be starved or evicted during pressure, and autoscalers go blind exactly when they are needed.

Correct Approach

Run at least two replicas, spread across nodes, with requests, a disruption budget, and a system priority.

ANTI-PATTERN-05 Avoid
Problem

Ignoring the health of the metrics pipeline.

Why It’s Harmful

Autoscalers freeze silently when metrics vanish, and the failure is discovered during a traffic spike.

Correct Approach

Alert on the API service, the Metrics Server pods, scrape failures, and autoscaler errors.

ANTI-PATTERN-06 Avoid
Problem

Relying on autoscaling alone for predictable sudden spikes.

Why It’s Harmful

Collection, checking, scheduling, and start-up delays mean new capacity arrives after the spike has already hurt users.

Correct Approach

Scale ahead of known events and keep a sensible minimum, leaving autoscaling to handle unexpected variation.

ANTI-PATTERN-07 Avoid
Problem

Treating a single reading as the truth about a pod.

Why It’s Harmful

Short spikes and averaging windows make single values misleading, leading to wrong conclusions about capacity.

Correct Approach

Use trends from a monitoring system for analysis, and keep the Metrics Server for automated decisions and quick looks.

23Best Practices and Common Mistakes

A short checklist for a dependable metrics pipeline.

Best Practices

  • Install the Metrics Server in high-availability mode for production
  • Keep kubelet certificate verification enabled and fix certificates properly
  • Set realistic requests and limits on all workloads
  • Pair it with a monitoring system for history and alerts
  • Alert on the health of the metrics pipeline itself
  • Review usage against requests on a regular schedule
  • Keep the component and its images up to date

Common Mistakes

  • Expecting history, graphs, or alerts from it
  • Forgetting that CPU needs two readings and new installs need time
  • Comparing its numbers directly with other tools without considering windows
  • Leaving workloads without requests and wondering why scaling fails
  • Blocking the kubelet port with firewalls or security groups
  • Installing a second copy on a platform that already provides one
!
Test Before Traffic Arrives

Generate artificial load against a test workload and watch the whole chain react: usage rises, the autoscaler notices, pods are added, and usage falls. Proving the chain in advance is far better than discovering a gap during a real spike.

24Real-World Scenarios

How teams use the Metrics Server in daily operations.

A retailer surviving a sale

An online retailer scales its storefront on CPU utilisation with a healthy minimum number of pods and a maximum that fits the cluster. During a sale, traffic triples. The autoscaler adds pods within a couple of minutes, and the team, who scaled up in advance for the announced start time, sees no slowdown.

A startup that never scaled

A startup enabled autoscaling and saw the target shown as unknown. The cause was missing CPU requests on the workload. After adding realistic requests based on observed usage, the autoscaler began showing real percentages and scaling as expected.

A bank fixing certificate trust

A bank’s security team refused a fix that disabled certificate verification. Instead, they issued kubelet serving certificates from the cluster’s authority that listed each node’s address, and the Metrics Server connected securely without any weakening of trust.

An operations team finding a hidden outage

After a network policy change, the API server could no longer reach the Metrics Server, and autoscalers silently froze. A new alert on the API service status caught the next occurrence within minutes, and the team restored the network path before any user noticed.

A platform team right-sizing requests

A platform team compared current usage with requests across all workloads and found many pods using a fraction of what they requested. Lowering the requests freed a large amount of capacity, allowing the cluster to run the same workloads on fewer nodes.

25Frequently Asked Questions

Q1What is the Metrics Server?

A cluster add-on that collects current CPU and memory usage of nodes and pods from every kubelet and serves it through the Kubernetes Metrics API. It powers command-line usage checks and autoscaling.

Q2Does the Metrics Server store historical data?

No. It keeps only the latest readings in memory. For history, graphs, and alerts, use a monitoring system.

Q3Why does the usage command say metrics are not available?

Often because the Metrics Server was just installed and has not completed enough collection cycles. If it persists, check the API service status, the pods, and the logs.

Q4Why does my autoscaler show unknown for its target?

Common reasons are missing resource requests on the pods, metrics not yet available for new pods, or an unavailable Metrics Server. Utilisation is calculated relative to requests, so requests are essential.

Q5Is it safe to skip kubelet certificate verification?

It is acceptable in a disposable development cluster, but not in production. It removes protection against impersonated nodes, and the underlying certificate problem should be fixed instead.

Q6How often does it collect data?

By default about every fifteen seconds. The interval can be changed within supported limits, but shortening it adds load on every node with little benefit for most autoscaling.

Q7Do I need it if I already run Prometheus?

Usually yes, for standard CPU and memory autoscaling and for the command-line usage tool. The two serve different purposes and are commonly run together.

Q8What does CPU usage in the Metrics API mean?

It is the average rate of processor use over a short window, expressed in cores or fractions of a core. Memory is reported as the working set, the memory in active use.

Q9Can it autoscale on requests per second?

Not by itself. It supports CPU and memory only. For other signals, use a custom or external metrics adapter fed from a monitoring system.

Q10What happens if the Metrics Server goes down?

Usage commands fail and autoscalers cannot read metrics, so they stop scaling. Existing pods keep running at their current size. Running multiple replicas and alerting on health reduces the risk.

Q11How many resources does it need?

Very little: roughly a thousandth of a core of CPU and a couple of megabytes of memory per node. Set requests accordingly and follow the project’s sizing guidance for large clusters.

Q12Why are my numbers different from another monitoring tool?

Tools sample at different moments, average over different windows, and may count memory differently. The Metrics Server reports short-window CPU rates and working-set memory, so small differences are expected.

26Summary and Key Takeaways

The Metrics Server is the small, standard component that tells a Kubernetes cluster how much CPU and memory its nodes and pods are using right now. It collects the numbers from every kubelet on a regular schedule, keeps only the latest values in memory, and serves them through the Metrics API using the API server’s aggregation layer. Its most important users are the command-line usage tool and the autoscalers, which rely on it to decide when to add or remove pods.

Its strength is its simplicity, and its limits follow from the same simplicity: no history, no alerts, and only two resource types. Using it well means setting realistic resource requests, running it in high availability with proper certificates and permissions, monitoring its own health, and pairing it with a full monitoring stack for everything it does not cover. With those habits, it quietly provides the live numbers that keep a cluster elastic and efficient.

Key Takeaways

  • It reports current CPU and memory only — the Metrics Server holds the latest readings in memory and offers no history, no alerts, and no other resource types.
  • Data flows from kubelets to the API — it scrapes every node on a schedule and serves the results through the Metrics API using the aggregation layer.
  • Autoscalers depend on it — the Horizontal Pod Autoscaler compares usage with each pod’s requests, so requests must be defined for scaling to work.
  • Freshness has limits — collection, autoscaler checks, scheduling, and start-up all add delay, so plan ahead for predictable spikes.
  • Keep trust intact — fix kubelet certificates instead of disabling verification in production, and grant only the narrow permissions the component needs.
  • Run it for resilience and watch it — use at least two replicas with proper priority, and alert on the API service, scrape failures, and autoscaler errors.
  • Pair it with a monitoring system — use the Metrics Server for automation and quick checks, and a full monitoring stack for history, dashboards, and alerting.