{"id":13451654,"url":"https://github.com/kubernetes-sigs/metrics-server","last_synced_at":"2025-08-07T23:56:16.627Z","repository":{"id":37396545,"uuid":"92132038","full_name":"kubernetes-sigs/metrics-server","owner":"kubernetes-sigs","description":"Scalable and efficient source of container resource metrics for Kubernetes built-in autoscaling pipelines.","archived":false,"fork":false,"pushed_at":"2024-04-05T19:13:22.000Z","size":12740,"stargazers_count":5383,"open_issues_count":65,"forks_count":1807,"subscribers_count":89,"default_branch":"master","last_synced_at":"2024-04-05T20:26:55.572Z","etag":null,"topics":["k8s-sig-instrumentation"],"latest_commit_sha":null,"homepage":"https://kubernetes.io/docs/tasks/debug-application-cluster/resource-metrics-pipeline/","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kubernetes-sigs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"code-of-conduct.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2017-05-23T05:15:43.000Z","updated_at":"2024-04-18T18:30:02.380Z","dependencies_parsed_at":"2023-07-13T10:32:22.406Z","dependency_job_id":"5a1c0e05-e67a-4023-b37c-986951e004d5","html_url":"https://github.com/kubernetes-sigs/metrics-server","commit_stats":null,"previous_names":["kubernetes-incubator/metrics-server"],"tags_count":41,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kubernetes-sigs%2Fmetrics-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kubernetes-sigs%2Fmetrics-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kubernetes-sigs%2Fmetrics-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kubernetes-sigs%2Fmetrics-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kubernetes-sigs","download_url":"https://codeload.github.com/kubernetes-sigs/metrics-server/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":213325050,"owners_count":15570228,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["k8s-sig-instrumentation"],"created_at":"2024-07-31T07:00:57.968Z","updated_at":"2025-08-07T23:56:16.564Z","avatar_url":"https://github.com/kubernetes-sigs.png","language":"Go","funding_links":[],"categories":["Go","others","Tools and Libraries","HarmonyOS"],"sub_categories":["Monitoring, Alerts, and Visualization","Windows Manager"],"readme":"# Kubernetes Metrics Server\n\nMetrics Server is a scalable, efficient source of container resource metrics for Kubernetes\nbuilt-in autoscaling pipelines.\n\nMetrics Server collects resource metrics from Kubelets and exposes them in Kubernetes apiserver through [Metrics API]\nfor use by [Horizontal Pod Autoscaler] and [Vertical Pod Autoscaler]. Metrics API can also be accessed by `kubectl top`,\nmaking it easier to debug autoscaling pipelines.\n\n\u003e [!CAUTION]\n\u003e Metrics Server is meant only for autoscaling purposes. For example, don't use it to forward metrics to monitoring solutions, or as a source of monitoring solution metrics. In such cases please collect metrics from Kubelet `/metrics/resource` endpoint directly.\n\nMetrics Server offers:\n\n- A single deployment that works on most clusters (see [Requirements](#requirements))\n- Fast autoscaling, collecting metrics every 15 seconds.\n- Resource efficiency, using 1 mili core of CPU and 2 MB of memory for each node in a cluster.\n- Scalable support up to 5,000 node clusters.\n\n[Metrics API]: https://github.com/kubernetes/metrics\n[Horizontal Pod Autoscaler]: https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/\n[Vertical Pod Autoscaler]: https://github.com/kubernetes/autoscaler/tree/master/vertical-pod-autoscaler/\n\n## Use cases\n\nYou can use Metrics Server for:\n\n- CPU/Memory based horizontal autoscaling (learn more about [Horizontal Autoscaling])\n- Automatically adjusting/suggesting resources needed by containers (learn more about [Vertical Autoscaling])\n\nDon't use Metrics Server when you need:\n\n- Non-Kubernetes clusters\n- An accurate source of resource usage metrics\n- Horizontal autoscaling based on other resources than CPU/Memory\n\nFor unsupported use cases, check out full monitoring solutions like [Prometheus](https://github.com/prometheus/prometheus).\n\n[Horizontal Autoscaling]: https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/\n[Vertical Autoscaling]: https://github.com/kubernetes/autoscaler/tree/master/vertical-pod-autoscaler/\n\n## Requirements\n\nMetrics Server has specific requirements for cluster and network configuration. These requirements aren't the default for all cluster\ndistributions. Please ensure that your cluster distribution supports these requirements before using Metrics Server:\n\n- The kube-apiserver must [enable an aggregation layer].\n- Nodes must have Webhook [authentication and authorization] enabled.\n- Kubelet certificate needs to be signed by cluster Certificate Authority (or disable certificate validation by passing `--kubelet-insecure-tls` to Metrics Server)\n- Container runtime must implement a [container metrics RPCs] (or have [cAdvisor] support)\n- Network should support following communication:\n  - Control plane to Metrics Server. Control plane node needs to reach Metrics Server's pod IP and port 10250 (or node IP and custom port if `hostNetwork` is enabled). Read more about [control plane to node communication](https://kubernetes.io/docs/concepts/architecture/control-plane-node-communication/#control-plane-to-node).\n  - Metrics Server to Kubelet on all nodes. Metrics server needs to reach node address and Kubelet port. Addresses and ports are configured in Kubelet and published as part of Node object. Addresses in `.status.addresses` and port in `.status.daemonEndpoints.kubeletEndpoint.port` field (default 10250). Metrics Server will pick first node address based on the list provided by `kubelet-preferred-address-types` command line flag (default `InternalIP,ExternalIP,Hostname` in manifests).\n\n[reachable from kube-apiserver]: https://kubernetes.io/docs/concepts/architecture/master-node-communication/#master-to-cluster\n[enable an aggregation layer]: https://kubernetes.io/docs/tasks/access-kubernetes-api/configure-aggregation-layer/\n[authentication and authorization]: https://kubernetes.io/docs/reference/access-authn-authz/kubelet-authn-authz/\n[container metrics RPCs]: https://github.com/kubernetes/community/blob/master/contributors/devel/sig-node/cri-container-stats.md\n[cAdvisor]: https://github.com/google/cadvisor\n\n## Installation\n\nMetrics Server can be installed either directly from YAML manifest or via the official [Helm chart](https://artifacthub.io/packages/helm/metrics-server/metrics-server). To install the latest Metrics Server release from the _components.yaml_ manifest, run the following command.\n\n```shell\nkubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml\n```\n\nInstallation instructions for previous releases can be found in [Metrics Server releases](https://github.com/kubernetes-sigs/metrics-server/releases).\n\n### Compatibility Matrix\n\nMetrics Server | Metrics API group/version | Supported Kubernetes version\n---------------|---------------------------|-----------------------------\n0.8.x          | `metrics.k8s.io/v1beta1`  | 1.31+\n0.7.x          | `metrics.k8s.io/v1beta1`  | 1.27+\n0.6.x          | `metrics.k8s.io/v1beta1`  | 1.25+\n0.5.x          | `metrics.k8s.io/v1beta1`  | *1.8+\n0.4.x          | `metrics.k8s.io/v1beta1`  | *1.8+\n0.3.x          | `metrics.k8s.io/v1beta1`  | 1.8-1.21\n\n*Kubernetes versions lower than v1.16 require passing the `--authorization-always-allow-paths=/livez,/readyz` command line flag\n\n### High Availability\n\nMetrics Server can be installed in high availability mode directly from a YAML manifest or via the official [Helm chart](https://artifacthub.io/packages/helm/metrics-server/metrics-server) by setting the `replicas` value greater than `1`. To install the latest Metrics Server release in high availability mode from the  _high-availability.yaml_ manifest, run the following command.\n\nOn Kubernetes v1.21+:\n\n```shell\nkubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/high-availability-1.21+.yaml\n```\n\nOn Kubernetes v1.19-1.21:\n\n```shell\nkubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/high-availability.yaml\n```\n\n\u003e[!NOTE]\n\u003e This configuration **requires** having a cluster with at least 2 nodes on which Metrics Server can be scheduled.\n\nAlso, to maximize the efficiency of this highly available configuration, it is **recommended** to add the `--enable-aggregator-routing=true` CLI flag to the kube-apiserver so that requests sent to Metrics Server are load balanced between the 2 instances.\n\n### Helm Chart\n\nThe [Helm chart](https://artifacthub.io/packages/helm/metrics-server/metrics-server) is maintained as an additional component within this repo and released into a chart repository backed on the `gh-pages` branch. A new version of the chart will be released for each Metrics Server release and can also be released independently if there is a need. The chart on the `master` branch shouldn't be referenced directly as it might contain modifications since it was last released, to view the chart code use the chart release tag.\n\n## Security context\n\nMetrics Server requires the `CAP_NET_BIND_SERVICE` capability in order to bind to a privileged ports as non-root.\nIf you are running Metrics Server in an environment that uses [PSSs](https://kubernetes.io/docs/concepts/security/pod-security-standards/) or other mechanisms to restrict pod capabilities, ensure that Metrics Server is allowed\nto use this capability.\nThis applies even if you use the `--secure-port` flag to change the port that Metrics Server binds to a non-privileged port.\n\n## Scaling\n\nStarting from v0.5.0 Metrics Server comes with default resource requests that should guarantee good performance for most cluster configurations up to 100 nodes:\n\n- 100m core of CPU\n- 200MiB of memory\n\nMetrics Server resource usage depends on multiple independent dimensions, creating a [Scalability Envelope].\nDefault Metrics Server configuration should work in clusters that don't exceed any of the thresholds listed below:\n\nQuantity               | Namespace threshold | Cluster threshold\n-----------------------|---------------------|------------------\n#Nodes                 | n/a                 | 100\n#Pods per node         | 70                  | 70\n#Deployments with HPAs | 100                 | 100\n\nResources can be adjusted proportionally based on number of nodes in the cluster.\nFor clusters of more than 100 nodes, allocate additionally:\n\n- 1m core per node\n- 2MiB memory per node\n\nYou can use the same approach to lower resource requests, but there is a boundary\nwhere this may impact other scalability dimensions like maximum number of pods per node.\n\n[Scalability Envelope]: https://github.com/kubernetes/community/blob/master/sig-scalability/configs-and-limits/thresholds.md\n\n### Configuration\n\nDepending on your cluster setup, you may also need to change flags passed to the Metrics Server container.\nMost useful flags:\n\n- `--kubelet-preferred-address-types` - The priority of node address types used when determining an address for connecting to a particular node (default [Hostname,InternalDNS,InternalIP,ExternalDNS,ExternalIP])\n- `--kubelet-insecure-tls` - Do not verify the CA of serving certificates presented by Kubelets. For testing purposes only.\n- `--requestheader-client-ca-file` - Specify a root certificate bundle for verifying client certificates on incoming requests.\n- `--node-selector` -Can complete to scrape the metrics from the Specified nodes based on labels\n\nYou can get a full list of Metrics Server configuration flags by running:\n\n```shell\ndocker run --rm registry.k8s.io/metrics-server/metrics-server:v0.8.0 --help\n```\n\n## Design\n\nMetrics Server is a component in the core metrics pipeline described in [Kubernetes monitoring architecture].\n\nFor more information, see:\n\n- [Metrics API design]\n- [Metrics Server design]\n\n[Kubernetes monitoring architecture]: https://github.com/kubernetes/design-proposals-archive/blob/main/instrumentation/monitoring_architecture.md\n[Metrics API design]: https://github.com/kubernetes/design-proposals-archive/blob/main/instrumentation/resource-metrics-api.md\n[Metrics Server design]: https://github.com/kubernetes/design-proposals-archive/blob/main/instrumentation/metrics-server.md\n\n## Have a question?\n\nBefore posting an issue, first checkout [Frequently Asked Questions] and [Known Issues].\n\n[Frequently Asked Questions]: FAQ.md\n[Known Issues]: KNOWN_ISSUES.md\n\n## Community, discussion, contribution, and support\n\nLearn how to engage with the Kubernetes community on the [community page].\n\nYou can reach the maintainers of this project at:\n\n- [Slack channel]\n- [Mailing list]\n\nThis project is maintained by [SIG Instrumentation]\n\n[community page]: http://kubernetes.io/community/\n[Slack channel]: https://kubernetes.slack.com/messages/sig-instrumentation\n[Mailing list]: https://groups.google.com/forum/#!forum/kubernetes-sig-instrumentation\n[SIG Instrumentation]: https://github.com/kubernetes/community/tree/master/sig-instrumentation\n\n### Code of conduct\n\nParticipation in the Kubernetes community is governed by the [Kubernetes Code of Conduct].\n\n[Kubernetes Code of Conduct]: code-of-conduct.md\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkubernetes-sigs%2Fmetrics-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkubernetes-sigs%2Fmetrics-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkubernetes-sigs%2Fmetrics-server/lists"}