|
| 1 | +--- |
| 2 | +approvers: |
| 3 | +- fgrzadkowski |
| 4 | +- piosz |
| 5 | +title: Core metrics pipeline |
| 6 | +--- |
| 7 | + |
| 8 | +Resource usage metrics are important for: |
| 9 | + * Kubernetes components to operate (e.g. autoscalers to automatically scale user applications) |
| 10 | + * Kubernetes users to understand their applications behavior |
| 11 | + |
| 12 | +In Kubernetes they are available through Metrics API. |
| 13 | + |
| 14 | +## Metrics API |
| 15 | + |
| 16 | +Metrics API provides current resource usage metrics for pods and nodes. It doesn't offer historical metrics, so one needs to |
| 17 | +archive metrics themselves. In the future Historical API might be defined but it will not be implemented as a part of |
| 18 | +the core metrics pipeline. |
| 19 | + |
| 20 | +The API is discoverable through the same endpoint as the other Kubernetes APIs under `/apis/metrics.k8s.io/` path. |
| 21 | +It also offers the same security, scalability and reliability guarantees. |
| 22 | + |
| 23 | +The API is defined in [k8s.io/metrics](https://github.com/kubernetes/metrics/tree/master/pkg/apis/metrics) repository, |
| 24 | +where the detailed semantic is explained. |
| 25 | + |
| 26 | +### Supported endpoints |
| 27 | + |
| 28 | +The list of supported endpoints in the API: |
| 29 | + |
| 30 | +- `/nodes` - all node metrics; support for `labelSelector` parameter |
| 31 | +- `/nodes/{node}` - metrics for the specified node |
| 32 | +- `/namespaces/{namespace}/pods` - all pod metrics within the namespace; support for `labelSelector` parameter |
| 33 | +- `/namespaces/{namespace}/pods/{pod}` - metrics for the specified pods |
| 34 | + |
| 35 | +## Metrics Server |
| 36 | + |
| 37 | +[Metrics Server](https://github.com/kubernetes-incubator/metrics-server) is a cluster-wide aggregator of monitoring data. |
| 38 | +Starting from Kubernetes 1.8 it's work on all Kubernetes setups |
| 39 | +and runs as a pod in a user space (on one of the nodes), similar to how any Kubernetes application would run. |
| 40 | + |
| 41 | +It discovers all nodes in the cluster and queries usage information from Summary API exposed by [Kubelet](/docs/admin/kubelet/)s. |
| 42 | + |
| 43 | +Metrics Server use the same authorization/authentication mechanism as the main API server. It's registered there through |
| 44 | +[Kubernetes aggregator](https://kubernetes.io/docs/concepts/api-extension/apiserver-aggregation/). |
| 45 | + |
| 46 | +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