| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Metrics Server is a scalable, efficient source of container resource metrics for Kubernetes built-in autoscaling pipelines.
Metrics Server collects resource metrics from Kubelets and exposes them in Kubernetes apiserver through Metrics API for use by Horizontal Pod Autoscaler and Vertical Pod Autoscaler. Metrics API can also be accessed by kubectl top, making it easier to debug autoscaling pipelines.
Caution
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.
Metrics Server offers:
You can use Metrics Server for:
Don't use Metrics Server when you need:
For unsupported use cases, check out full monitoring solutions like Prometheus.
Metrics Server has specific requirements for cluster and network configuration. These requirements aren't the default for all cluster distributions. Please ensure that your cluster distribution supports these requirements before using Metrics Server:
Metrics Server can be installed either directly from YAML manifest or via the official Helm chart. To install the latest Metrics Server release from the components.yaml manifest, run the following command.
kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yamlInstallation instructions for previous releases can be found in Metrics Server releases.
| Metrics Server | Metrics API group/version | Supported Kubernetes version |
|---|---|---|
| 0.9.x | metrics.k8s.io/v1beta1 | 1.34+ |
| 0.8.x | metrics.k8s.io/v1beta1 | 1.31+ |
| 0.7.x | metrics.k8s.io/v1beta1 | 1.27+ |
| 0.6.x | metrics.k8s.io/v1beta1 | 1.25+ |
| 0.5.x | metrics.k8s.io/v1beta1 | *1.8+ |
| 0.4.x | metrics.k8s.io/v1beta1 | *1.8+ |
| 0.3.x | metrics.k8s.io/v1beta1 | 1.8-1.21 |
*Kubernetes versions lower than v1.16 require passing the --authorization-always-allow-paths=/livez,/readyz command line flag
Metrics Server follows the Kubernetes Version Skew Policy.
The kube-apiserver version must be within the supported Kubernetes version range listed in the Compatibility Matrix above.
For full details, refer to the official Kubernetes Version Skew Policy: https://kubernetes.io/releases/version-skew-policy/
Metrics Server can be installed in high availability mode directly from a YAML manifest or via the official Helm chart 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.
On Kubernetes v1.21+:
kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/high-availability-1.21+.yamlOn Kubernetes v1.19-1.21:
kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/high-availability.yamlNote
This configuration requires having a cluster with at least 2 nodes on which Metrics Server can be scheduled.
Also, 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.
The Helm chart 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.
Metrics Server requires the CAP_NET_BIND_SERVICE capability in order to bind to a privileged ports as non-root. If you are running Metrics Server in an environment that uses PSSs or other mechanisms to restrict pod capabilities, ensure that Metrics Server is allowed to use this capability. This applies even if you use the --secure-port flag to change the port that Metrics Server binds to a non-privileged port.
Starting from v0.5.0 Metrics Server comes with default resource requests that should guarantee good performance for most cluster configurations up to 100 nodes:
Metrics Server resource usage depends on multiple independent dimensions, creating a Scalability Envelope. Default Metrics Server configuration should work in clusters that don't exceed any of the thresholds listed below:
| Quantity | Namespace threshold | Cluster threshold |
|---|---|---|
| #Nodes | n/a | 100 |
| #Pods per node | 70 | 70 |
| #Deployments with HPAs | 100 | 100 |
Resources can be adjusted proportionally based on number of nodes in the cluster. For clusters of more than 100 nodes, allocate additionally:
You can use the same approach to lower resource requests, but there is a boundary where this may impact other scalability dimensions like maximum number of pods per node.
Depending on your cluster setup, you may also need to change flags passed to the Metrics Server container. Most useful flags:
You can get a full list of Metrics Server configuration flags by running:
docker run --rm registry.k8s.io/metrics-server/metrics-server:v0.9.0 --helpMetrics Server is a component in the core metrics pipeline described in Kubernetes monitoring architecture.
For more information, see:
This diagram shows how metrics-server handles a kubectl top pods request:
sequenceDiagram
participant User
participant APIServer
participant MS as Metrics-server
User->>APIServer: GET /apis/metrics.k8s.io/v1beta1/pods
APIServer->>MS: GET /apis/metrics.k8s.io/v1beta1/pods
MS->>MS: use Pod Informer to get a list of pods
MS->>MS: lookup each pod's memory and cpu from its in-memory cache
MS->>APIServer: metrics.PodMetricsList
APIServer->>User: Response
sequenceDiagram
participant MS as Metrics-server
participant KL as Kubelet
MS->>MS: use Node informer to get a list of nodes and their IPs periodically
MS->>KL: GET /metrics/resource
KL->>MS: returns memory and cpu data for each pod
MS->>MS: update its in-memory cache to store memory and cpu data for each pod
Before posting an issue, first checkout Frequently Asked Questions and Known Issues.
Learn how to engage with the Kubernetes community on the community page.
You can reach the maintainers of this project at:
This project is maintained by SIG Instrumentation
Participation in the Kubernetes community is governed by the Kubernetes Code of Conduct.
| Back | FazBrowse Home | New Git URL |