|
| 1 | +--- |
| 2 | +approvers: |
| 3 | +- fgrzadkowski |
| 4 | +- piosz |
| 5 | +title: Core metrics pipeline |
| 6 | +--- |
| 7 | + |
| 8 | +Starting from Kubernetes 1.8, resource usage metrics, such as container CPU and memory usage, |
| 9 | +are available in Kubernetes through the Metrics API. These metrics can be either accessed directly |
| 10 | +by user, for example by using `kubectl top` command, or used by a controller in the cluster, e.g. |
| 11 | +Horizontal Pod Autoscaler, to make decisions. |
| 12 | + |
| 13 | +## The Metrics API |
| 14 | + |
| 15 | +Through the Metrics API you can get the amount of resource currently used |
| 16 | +by a given node or a given pod. This API doesn't store the metric values, |
| 17 | +so it's not possible for example to get the amount of resources used by a |
| 18 | +given node 10 minutes ago. |
| 19 | + |
| 20 | +The API no different from any other API: |
| 21 | + |
| 22 | +- it is discoverable through the same endpoint as the other Kubernetes APIs under `/apis/metrics.k8s.io/` path |
| 23 | +- it offers the same security, scalability and reliability guarantees |
| 24 | + |
| 25 | +The API is defined in [k8s.io/metrics](https://github.com/kubernetes/metrics/blob/master/pkg/apis/metrics/v1beta1/types.go) |
| 26 | +repository. You can find more information about the API there. |
| 27 | + |
| 28 | +**Note:** The API requires metrics server to be deployed in the cluster. Otherwise it will be not available. |
| 29 | + |
| 30 | +## Metrics Server |
| 31 | + |
| 32 | +[Metrics Server](https://github.com/kubernetes-incubator/metrics-server) is a cluster-wide aggregator of resource usage data. |
| 33 | +Starting from Kubernetes 1.8 it's deployed by default in clusters created by `kube-up.sh` script |
| 34 | +as a Deployment object. If you use a different Kubernetes setup mechanism you can deploy it using the provided |
| 35 | +[deployment yamls](https://github.com/kubernetes-incubator/metrics-server/tree/master/deploy). |
| 36 | +It's supported in Kubernetes 1.7+ (see details below). |
| 37 | + |
| 38 | +Metric server collects metrics from the Summary API, exposed by [Kubelet](/docs/admin/kubelet/) on each node. |
| 39 | + |
| 40 | +Metrics Server registered in the main API server through |
| 41 | +[Kubernetes aggregator](https://kubernetes.io/docs/concepts/api-extension/apiserver-aggregation/), |
| 42 | +which was introduced in Kubernetes 1.7. |
| 43 | + |
| 44 | +Learn more about the metrics server in [the design doc](https://github.com/kubernetes/community/blob/master/contributors/design-proposals/instrumentation/metrics-server.md). |
0 commit comments