Kubernetes metrics-server for autoscaling: what it does and when you need it
If you are deciding whether your self-managed cluster can scale workloads automatically or whether an operator can see live CPU and memory use with kubectl top, the answer starts with metrics-server. It supplies the resource metrics API that the Horizontal Pod Autoscaler reads to decide how many replicas a workload needs, and that same API serves the values kubectl top prints for nodes and pods. Without it, an HPA defined on CPU or memory has no data to act on, and kubectl top returns errors instead of usage figures. A team needs metrics-server installed whenever it plans to use resource-based autoscaling or wants quick, command-line visibility into current consumption across the cluster.
metrics-server is deliberately narrow. It keeps only recent CPU and memory samples in memory, reports them for nodes and pods, and does not store history, expose custom or application metrics, or provide the query layer that dashboards and alerts depend on. Those needs belong to a full monitoring stack, and the sibling section on kube-prometheus-stack covers that path. Before you plan capacity work, confirm which resource metrics your autoscaling design needs (CPU only, memory, or custom metrics through a separate adapter), because a Horizontal Pod Autoscaler that targets anything beyond the resource metrics API needs a different data source.
Plan the installation as a cluster component with a clear owner. Check that the API aggregation layer is enabled on your control plane, confirm which metrics-server release matches your Kubernetes minor version by reading the compatibility notes in the project documentation, and decide who will maintain the kubelet TLS settings, which often need adjustment on kubeadm and other self-managed clusters. Ask your implementation partner or internal platform team to confirm these points in your environment before any autoscaling policy goes into production.
Configuration options and when each fits
This table compares the main metrics-server configuration choices: kubelet TLS handling, kubelet address resolution, replica count and placement, and resource requests. Read each row for the condition that makes an option appropriate and the risk of choosing the alternative. Confirm exact flag names and defaults against the metrics-server release you install before writing manifests.
| Option | When it fits | Risk of the alternative |
|---|---|---|
| Verified kubelet TLS (default posture) | Any cluster that will run HPA or kubectl top beyond a short test, where kubelet serving certificates are issued by a CA the cluster trusts | Skipping verification leaves the scrape path open to impersonation of kubelets and weakens the trust model for the whole autoscaling pipeline |
| Insecure kubelet TLS (skip verification) | Disposable test or lab clusters where kubelet certificates are self-signed and no sensitive data flows through the metrics path | Metrics can be spoofed by anything that answers on the kubelet address, and the setting is easy to leave behind in production manifests |
| Kubelet address preference: InternalIP | Most clusters with stable node IPs on a dedicated node network, where node InternalIP is reachable from the metrics-server pod | Nodes with unreachable or multiple internal addresses may fail scrapes, so HPA reports missing metrics for those nodes |
| Kubelet address preference: hostname | Clusters where node names resolve reliably through cluster DNS or host files and IPs change often | DNS gaps or stale records cause scrape failures that look like kubelet outages |
| Kubelet address preference: DNS | Environments that publish node DNS records and want names to follow node moves without manifest edits | Records that lag behind node changes produce intermittent scrape errors that are hard to correlate with node events |
| Single replica | Small or non-critical clusters where a short metrics gap pauses scaling decisions without harming workloads | A single pod restart or node drain stops resource metrics, so HPA holds its last decisions until metrics return |
| Two or more replicas with pod anti-affinity | Production clusters where autoscaling must continue through node maintenance, placed so replicas land on different nodes | Replicas on the same node fail together, removing the availability benefit of running more than one |
| Modest resource requests and limits | Clusters where metrics-server load grows with node and pod count, so requests are set from observed usage in your environment | Requests set too low get the pod evicted under pressure, and limits set too low cause restarts that drop metrics |
Setup sequence for metrics-server with HPA and kubectl top
This sequence takes a self-managed cluster from no resource metrics to a working metrics API, confirmed kubectl top output and a test HorizontalPodAutoscaler that reads CPU and memory figures. Each step closes with a check the platform team can run and record.
Confirm the aggregation layer and API server settings
The platform engineer checks that the kube-apiserver serves the aggregation layer, which metrics-server needs in order to register the metrics.k8s.io API. Confirm the front-proxy client certificate and request header settings are present on the API server, and check whether your distribution already ships a metrics API. Ask the distribution vendor or review its documentation, because some installers enable this by default. The step is done when you can list the existing APIService objects and see no conflicting metrics.k8s.io registration, or you know which one you need to remove before deploying.
Verify kubelet serving certificates and scrape path
Metrics-server scrapes each node's kubelet over HTTPS, so the kubelet serving certificates must be valid for the addresses metrics-server uses to reach them. Confirm whether kubelets issue serving certificates with the correct node names or IP addresses in their subject alternative names. If they do not, plan the kubelet TLS argument changes for your environment and record them as a deliberate exception, not a default. Test name resolution and network access from the kube-system namespace to port 10250 on a sample of nodes. The step is done when a test request from a pod in the cluster reaches the kubelet on each sampled node and the certificate chain validates or the exception is documented.
Stage the metrics-server image and manifests
Copy the metrics-server manifests and container image into your approved internal registry if the cluster cannot pull from public registries. Kubeadm can point at a private registry through the image repository setting, so use the same internal source for the control plane images and add-ons. Review the manifest for the image tag, replica count, resource requests and any TLS arguments you agreed in the previous steps. Store the reviewed manifest in version control so changes go through review. The step is done when the image pulls successfully on a test node from the internal registry and the manifest diff is approved and committed.
Deploy metrics-server from the reviewed manifests
The platform engineer applies the reviewed manifests to the cluster, which creates the service account, RBAC rules, the Deployment, the Service and the APIService registration. Check that the pods reach the Running state and the readiness probe passes. Confirm the deployment matches the approved manifest and that no other metrics provider is running against the same API group. Record the applied version and the source commit. The step is done when
kubectl get pods -n kube-systemshows the metrics-server pods ready and the logs show no repeated scrape errors for kubelet addresses.Verify the APIService is available
Run
kubectl get apiservice v1beta1.metrics.k8s.ioand confirm the AVAILABLE condition is True. If it reports False, read the condition message, which usually names the failing service, certificate or network path. Fix the root cause at the step where it belongs, such as the kubelet certificate or the aggregation settings, rather than skipping the check. The step is done when the APIService reports Available and stays that way across several minutes of checks, which confirms the aggregated API answers requests from the control plane.Confirm kubectl top returns node and pod data
Run
kubectl top nodesandkubectl top pods -Afrom an operator workstation with cluster-read access. Both commands should return CPU and memory figures for every node and for running pods. Spot-check a few values against the kubelet summary on a node. Empty output usually points to a scrape failure, a missing pod that is still warming up, or an RBAC issue for the operator account. The step is done when both commands return current figures for all nodes and the pods in a sample namespace.Create a test HPA and confirm it reads metrics
In a non-production namespace, deploy a small test workload with CPU requests set, then create a HorizontalPodAutoscaler that targets average CPU utilization. Generate modest load with a short-lived client pod that you remove afterward. Run
kubectl get hpaand check that the TARGETS column shows a current percentage instead of unknown. Confirm the replica count changes as load changes, then remove the load and the test resources. The step is done when the HPA reports a live current value and the test namespace is cleaned up, leaving a short record of the test results for the change file.Keep metrics-server out of monitoring and alerting
Document that metrics-server serves only the current resource snapshot used by HPA and kubectl top, so it does not hold history and should not be the source for dashboards or alerts. Route cluster dashboards and paging alerts to the monitoring stack you run separately, and tell the on-call team which tool answers which question. Confirm the runbook names the owner of metrics-server upgrades. The step is done when the runbook and the on-call handbook both point to the monitoring stack for alerting, and no alert rule in the cluster queries the metrics API.
Security and operational considerations for metrics-server
metrics-server sits in the cluster's control path: it reads resource data from every kubelet and serves it through the aggregated API that HPA and kubectl top depend on. The cards below cover the trust, permission, network and upgrade decisions that determine whether it stays a low-risk component.
Kubelet TLS and certificate trust
metrics-server scrapes each kubelet over HTTPS on port 10250. The usual shortcut is to skip kubelet certificate verification, which lets any host that answers on that address pass as a node. Decide whether kubelet serving certificates are issued by your cluster CA with the right node names in their SANs, then configure metrics-server to verify them. Confirm the exact flags for your metrics-server release in its documentation before changing defaults.
Kubernetes authentication docsRBAC for node and pod metrics
metrics-server needs read access to node and pod metrics and to the nodes and pods it uses for discovery. It should not receive broader rights. Review the ClusterRole it ships with, confirm it grants only get and list on the metrics resources, and check that no other workload has been bound to that role. Include the ClusterRoleBinding and the auth-reader binding in your review, since they control how the aggregated API authenticates callers.
Network policy for kubelet access
metrics-server must reach every kubelet on its scrape port, and the kube-apiserver must reach metrics-server to serve the metrics API. Restrict both paths with NetworkPolicy where your CNI enforces it. Allow ingress to metrics-server only from the API server, and egress to kubelet addresses on port 10250 only. Test the policy with a scrape and an HPA read after applying it, because a blocked path shows up as missing metrics rather than as a clear error.
Image provenance from a private registry
In an air-gapped or restricted environment, mirror the metrics-server image into your private registry and pin it by digest rather than by a floating tag. Record which image digest runs in each cluster, and scan it with your standard image pipeline. Confirm that your registry mirror and admission rules accept the same digest that your change record names, so the running version matches what was reviewed.
The aggregated API as an attack surface
Registering metrics-server adds the metrics.k8s.io API group to the kube-apiserver, which proxies requests to it. Any principal allowed to read that group can see resource usage for every pod and node. Limit read access to the group with RBAC, keep metrics-server off public networks, and watch APIService status for a registration that is unavailable or points somewhere unexpected. Treat a missing or duplicate APIService as a security event.
Upgrade alignment with version skew
Upgrade metrics-server in step with the cluster, and check its compatibility table for your Kubernetes minor version before each change. The version skew policy requires kube-apiserver to move one minor version at a time, and kubelets may lag the API server by up to three minor versions. Schedule metrics-server upgrades after control plane upgrades, verify kubectl top and HPA after each step, and keep the change in the same runbook as your cluster upgrade.
- Maximum kubelet lag
- 3 minor versions
How metrics-server data reaches HPA and kubectl top
The flow starts at the kubelet on each node, which serves resource usage through its summary endpoint. Metrics-server pods scrape those endpoints and keep the latest values in memory, then serve them through the aggregated metrics.k8s.io API. The HPA controller and kubectl top both read from that API. The separate boundary shows Prometheus and alerting, which collect their data on their own path and never read this API, so check that no alert rule depends on metrics-server values.
Metrics-server feeds HPA and kubectl top, separate from Prometheus and alerting.
Running metrics-server highly available without overloading kubelets
Running two or more metrics-server replicas keeps HPA and kubectl top working when one pod is restarted, drained or evicted. The replicas do not elect a leader. Each one scrapes the kubelets on every node and serves the same aggregated Metrics API, so any replica can answer a request, and a failed replica is simply removed from the Service endpoints. Set replicas to at least 2 in the chart values, and confirm that your cluster's kube-system namespace and Service configuration match what your chosen install method expects. Because every replica pulls from every kubelet, adding replicas increases load on kubelets, so the goal is availability without multiplying scrape traffic beyond what your nodes can absorb.
Use a PodDisruptionBudget so that node drains and cluster upgrades never remove all replicas at once. A budget that allows one replica to be unavailable is a common starting point for a two-replica deployment, but confirm the value against how many replicas you run and how long your autoscaling can tolerate missing metrics. Pair the budget with pod anti-affinity or topology spread constraints on kubernetes.io/hostname so the replicas land on different nodes. Check the scheduling result after installation with kubectl get pods -n kube-system -o wide, because a budget does not help if both replicas share a node that gets drained.
Resource requests and limits for metrics-server should be sized from measurements in your own cluster, not from figures copied out of a tutorial. Memory and CPU use grow with the number of nodes and pods, since each scrape cycle returns more data to process. Watch the pod's actual usage over several days of normal and peak activity, then adjust the requests and any memory limit with a margin for growth. Re-measure after large node pool changes, and treat a restart loop from an undersized memory limit as a signal to revisit sizing rather than a reason to remove the limit. Ask your platform team which scrape interval and kubelet settings the cluster already uses, because those determine how much load every replica places on each node.
Why metrics-server must not feed monitoring or alerting
metrics-server answers one narrow question well: how much CPU and memory each pod and node uses right now. The four cards explain why that answer cannot carry monitoring or alerting, and where the data for those jobs should come from instead. Each card names the sibling topic that covers the replacement.
Short retention and no history
metrics-server keeps only the most recent CPU and memory samples in memory and serves them through the API. It does not write a time series, so there is no history to examine after an incident, no trend for capacity planning and no way to compare this week with last week. Any question that starts with when needs a time-series store. Check that your team does not build dashboards or reports on kubectl top output. Long-term storage is covered in the Long-term Kubernetes metrics with Thanos topic.
No labels for SLO analysis
The resource metrics API returns usage per pod and per node. It carries no request latency, error counts, route or status code dimensions, and no custom series from your applications. Without those labels you cannot calculate an error budget, a burn rate or the latency percentile that an SLO is written against. Collect SLO inputs from application and ingress metrics. Ask your team which series each SLO depends on before deciding where it is collected. The Kubernetes monitoring with kube-prometheus-stack topic covers the scrape setup.
Coupling autoscaling to alerting
The HPA reads resource metrics through the aggregated metrics API. If alert rules or a notification pipeline also depend on metrics-server, one fault can hide a scaling problem and an alerting problem at the same time, and responders cannot tell which component failed. Keep the autoscaling path and the alerting path separate so each can be tested and restored on its own. Review everything that reads from the metrics API, including dashboards, scripts and admission policies, before you enable an alert that uses it.
Monitoring data from the right source
Build alerting from Prometheus scrapes instead. kube-prometheus-stack collects kubelet and cAdvisor container metrics, kube-state-metrics object state and node exporter host data, and holds the rules that page people. Control plane signals such as API server latency and errors, scheduler and controller health, and etcd leader changes come from their own endpoints and need their own alerts, as covered in the Monitoring the Kubernetes control plane and etcd topic. Confirm the scrape targets on your distribution, because component endpoints and their access settings vary.
Questions buyers ask before installing metrics-server
Can our team install metrics-server on its own?
Yes, many teams can, provided they have someone comfortable with Kubernetes RBAC, Deployments and the API aggregation layer, and access to the cluster's kubelets. The install itself is a small set of manifests or a Helm chart. The effort comes from confirming that kubelets serve metrics in a way metrics-server can verify, that the images can be pulled in your environment, and that HPA and kubectl top return data afterward. Decide early whether an engineer on your team will own this component for the life of the cluster, since it sits on the path for autoscaling decisions.
What makes the metrics-server installation take more effort than expected?
Three areas drive most of the work. First, kubelet serving certificates: many clusters use certificates that metrics-server cannot validate by default, so teams either issue proper kubelet certificates or adjust TLS settings, and each choice has security consequences you should review. Second, registry access: in clusters without internet access, the image must be mirrored to a private registry and referenced in the deployment. Third, the aggregation layer: metrics-server registers an APIService, and misconfigured front-proxy certificates or network rules leave the metrics API unavailable even when the pod is healthy.
What does the work need from our team?
You need named owners for four things: cluster-admin access for the install and the APIService, a person who can approve kubelet TLS changes, access to your private registry for the image, and a test plan that proves HPA scales workloads on real load. Your team also needs to decide where the component runs, usually as a Deployment with more than one replica in the kube-system namespace, and who is paged if kubectl top stops working. Without these owners, the component tends to be installed quickly and then left with unreviewed TLS shortcuts.
How long does a fixed-scope metrics-server engagement run?
The duration depends on the written scope, and DeployOpen agrees scope, deliverables and timelines in writing before work starts. The variables that change the schedule are the number of clusters, how many kubelet configurations differ, whether internet access is limited, and whether autoscaling targets need to be tested under load. Ask the partner to state the included clusters, the environments covered, the verification steps and the handover items in the quote, so you can compare it with the internal effort your team estimates.
What recurs after metrics-server is installed?
Metrics-server needs ongoing attention because it follows the Kubernetes release cycle. The project maintains the three most recent minor releases, and the version skew policy requires kube-apiserver to be upgraded one minor version at a time, with kubelets allowed to be up to three minor versions older than the API server. Each cluster upgrade therefore needs a check that the metrics-server version still matches the supported API and that kubelet metrics endpoints still respond. Plan this as recurring operations work, and include it in any retainer or internal runbook.
Should we use metrics-server for monitoring and alerting too?
No. Metrics-server keeps only a short window of recent resource usage in memory and exposes it through the resource metrics API for HPA, VPA and kubectl top. It does not provide the history, labels, recording rules or alert routing that monitoring needs. Use a monitoring stack such as the kube-prometheus-stack for dashboards and alerts, and keep metrics-server scoped to autoscaling and quick inspection. Mixing the two makes alerts depend on an API that was not designed for retention, and it complicates incident review.
When should we choose a partner instead of installing it ourselves?
Choose a partner when the cluster has custom kubelet certificate authorities, several clusters with different TLS settings, air-gapped image distribution, or autoscaling that must be proven under load before a launch. A partner also helps when your internal team lacks time to write runbooks and verification steps. Choose your own team when you have one standard cluster, an internet-connected registry and engineers who already run aggregated APIs. Either way, ask for the written scope, the verification evidence and a handover of configuration and upgrade steps.
Limits to confirm in your environment
metrics-server looks like a small add-on, but its behavior depends on your cluster version, your distribution's defaults and your network. The checks below cover what usually differs between a lab install and a production cluster, and each one changes whether HPA works on day one.
Matching metrics-server release
Each metrics-server release supports a range of Kubernetes minor versions, and a mismatch can leave the API service unavailable or return partial data. Confirm the release notes for your exact cluster minor version before choosing an image tag. Your cluster is on a supported minor version only while the project maintains it, so plan the metrics-server version alongside any upgrade of the control plane and kubelets. Treat the compatibility table in the project's documentation as the source of truth, not an older blog post.
Version skew policyDistribution and managed defaults
Some distributions and managed services already ship metrics-server, and others leave it out or install it with different flags. Check whether it is present, which version it runs and whether its arguments were changed before you add a second copy. A duplicate deployment or a Helm release that conflicts with a bundled one causes confusing errors. Ask your provider which resource requests, replica count and kubelet arguments they set by default, because those defaults decide how the add-on behaves under load.
Kubelet serving certificates
By default, metrics-server validates kubelet serving certificates against the cluster CA, and many clusters fail at this step because kubelets present self-signed or IP-only certificates. Find out how your distribution issues kubelet serving certs and whether kubelets request them through certificate signing requests. Options such as skipping verification exist, but they weaken the trust path between components and should be a documented, time-limited decision. Confirm the setting in the cluster itself rather than assuming it from the distribution name.
Custom and external metrics for HPA
Resource metrics from metrics-server cover CPU and memory only. If your scaling policy needs request rate, queue depth or any value from a monitoring stack, HPA also needs the custom metrics API or the external metrics API, served by a separate adapter. That adapter is a different component with its own install, permissions and failure modes. Decide early which signals drive scaling, because the answer determines whether metrics-server alone is enough and who owns the adapter.
Air-gapped image availability
In a network without internet access, the metrics-server image and any manifest it references must come from your private registry. Confirm the exact image name and tag your release uses, mirror it, and check that the cluster's image pull configuration can reach the mirror. Recheck this during every upgrade, because a new release may use a different tag or registry path. The mirror step is easy to miss until a pod stays in ImagePullBackOff after installation.
How DeployOpen scopes metrics-server work
DeployOpen plans and implements metrics-server inside your own infrastructure as a fixed-scope engagement. Before work starts, the scope, deliverables and timeline are agreed in writing. For this component that scope usually covers the cluster and network conditions that decide whether HPA and kubectl top work: the kube-apiserver aggregation layer, the APIService registration for metrics.k8s.io, the kubelet certificate and address settings on every node, the namespace and RBAC objects, and the replica count and placement of the Deployment. It also covers the verification steps that prove the setup works, such as checking that kubectl top nodes and kubectl top pods return data and that a test HPA reads its CPU and memory targets. Ask for the scope to name each of these items so you can see what is included and what remains with your team.
The written scope should also list the deliverables your team keeps. Typical items are the Helm values or manifests used, a record of the kubelet TLS choice and why it was made, the rollout and rollback steps, and a short runbook for the failure modes your operators will meet, such as an APIService showing as unavailable or a node that stops reporting resource metrics. Ask whether the deliverables are stored in your Git repository, who holds the admin credentials after handover, and what happens if the cluster is upgraded before the handover review is complete. Because the cost of this work is mostly the time to read your cluster and agree the kubelet and network decisions with your team, a quote should break the fee down by discovery, build, verification and handover, and state which of those steps are one-time.
Metrics-server is a component that needs ongoing attention, because each Kubernetes minor release changes the supported versions and the skew rules that apply to it. DeployOpen can run upgrades, retesting of HPA behavior and the review of release notes under a retainer, so the component is checked against each cluster upgrade rather than left to drift. Confirm the retainer terms in writing: which Kubernetes versions and metrics-server versions are covered, how upgrade windows are set, and who is responsible for rollback. Also confirm with your platform team whether any node-level monitoring or alerting is planned, since metrics-server data is intended for autoscaling and kubectl top only and should be fed to a separate monitoring stack.

