Skip to content

Commit 27550bc

Browse files
author
Tim Bannister
committed
Split out node metrics into reference section
1 parent 5105718 commit 27550bc

File tree

3 files changed

+72
-41
lines changed

3 files changed

+72
-41
lines changed
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
---
2+
title: Node metrics data
3+
content_type: reference
4+
weight: 50
5+
description: >-
6+
Mechanisms for accessing metrics at node, volume, pod and container level,
7+
as seen by the kubelet.
8+
---
9+
10+
The [kubelet](/docs/reference/command-line-tools-reference/kubelet/)
11+
gathers metric statistics at the node, volume, pod and container level,
12+
and emits this information in the
13+
[Summary API](https://github.com/kubernetes/kubernetes/blob/7d309e0104fedb57280b261e5677d919cb2a0e2d/staging/src/k8s.io/kubelet/pkg/apis/stats/v1alpha1/types.go).
14+
15+
You can send a proxied request to the stats summary API via the
16+
Kubernetes API server.
17+
18+
Here is an example of a Summary API request for a node named `minikube`:
19+
20+
```shell
21+
kubectl get --raw "/api/v1/nodes/minikube/proxy/stats/summary"
22+
```
23+
24+
Here is the same API call using `curl`:
25+
26+
```shell
27+
# You need to run "kubectl proxy" first
28+
# Change 8080 to the port that "kubectl proxy" assigns
29+
curl http://localhost:8080/api/v1/nodes/minikube/proxy/stats/summary
30+
```
31+
32+
{{< note >}}
33+
Beginning with `metrics-server` 0.6.x, `metrics-server` queries the `/metrics/resource`
34+
kubelet endpoint, and not `/stats/summary`.
35+
{{< /note >}}
36+
37+
## Summary metrics API source {#summary-api-source}
38+
39+
By default, Kubernetes fetches node summary metrics data using an embedded
40+
[cAdvisor](https://github.com/google/cadvisor) that runs within the kubelet.
41+
42+
## Summary API data via CRI {#pod-and-container-stats-from-cri}
43+
44+
{{< feature-state for_k8s_version="v1.23" state="alpha" >}}
45+
46+
If you enable the `PodAndContainerStatsFromCRI`
47+
[feature gate](/docs/reference/command-line-tools-reference/feature-gates/) in your
48+
cluster, and you use a container runtime that supports statistics access via
49+
{{< glossary_tooltip term_id="cri" text="Container Runtime Interface">}} (CRI), then
50+
the kubelet fetches Pod- and container-level metric data using CRI, and not via cAdvisor.
51+
52+
## {{% heading "whatsnext" %}}
53+
54+
The task pages for [Troubleshooting Clusters](/docs/tasks/debug/debug-cluster/) discuss
55+
how to use a metrics pipeline that rely on these data.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,17 @@
11
---
22
title: Node Reference Information
33
weight: 80
4+
no_list: true
45
---
6+
7+
This section contains the following reference topics about nodes:
8+
9+
* the kubelet's [checkpoint API](/docs/reference/node/kubelet-checkpoint-api/)
10+
* a list of [Articles on dockershim Removal and on Using CRI-compatible Runtimes](/docs/reference/node/topics-on-dockershim-and-cri-compatible-runtimes/)
11+
12+
You can also read node reference details from elsewhere in the
13+
Kubernetes documentation, including:
14+
15+
* [Node Metrics Data](/docs/reference/instrumentation/node-metrics).
16+
17+

content/en/docs/tasks/debug/debug-cluster/resource-metrics-pipeline.md

Lines changed: 4 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,8 @@ to collect metrics from each node. Depending on the metrics-server version it us
232232
* Metrics resource endpoint `/metrics/resource` in version v0.6.0+ or
233233
* Summary API endpoint `/stats/summary` in older versions
234234

235+
## {{% heading "whatsnext" %}}
236+
235237
To learn more about the metrics-server, see the
236238
[metrics-server repository](https://github.com/kubernetes-sigs/metrics-server).
237239

@@ -243,44 +245,5 @@ You can also check out the following:
243245
* [metrics-server releases](https://github.com/kubernetes-sigs/metrics-server/releases)
244246
* [Horizontal Pod Autoscaling](/docs/tasks/run-application/horizontal-pod-autoscale/)
245247

246-
## Node metrics data
247-
248-
The [kubelet](/docs/reference/command-line-tools-reference/kubelet/)
249-
gathers metric statistics at the node, volume, pod and container level,
250-
and emits this information in the
251-
[Summary API](https://github.com/kubernetes/kubernetes/blob/7d309e0104fedb57280b261e5677d919cb2a0e2d/staging/src/k8s.io/kubelet/pkg/apis/stats/v1alpha1/types.go).
252-
253-
You can send a proxied request to the stats summary API via the
254-
Kubernetes API server.
255-
256-
Here is an example of a Summary API request for a node named `minikube`:
257-
258-
```shell
259-
kubectl get --raw "/api/v1/nodes/minikube/proxy/stats/summary"
260-
```
261-
262-
Here is the same API call using `curl`:
263-
264-
```shell
265-
curl http://localhost:8080/api/v1/nodes/minikube/proxy/stats/summary
266-
```
267-
268-
{{< note >}}
269-
Beginning with `metrics-server` 0.6.x, `metrics-server` queries the `/metrics/resource`
270-
kubelet endpoint, and not `/stats/summary`.
271-
{{< /note >}}
272-
273-
### Summary metrics API source {#summary-api-source}
274-
275-
By default, Kubernetes fetches node summary metrics data using an embedded
276-
[cAdvisor](https://github.com/google/cadvisor) that runs with in the kubelet.
277-
278-
### Summary API data via CRI {#pod-and-container-stats-from-cri}
279-
280-
{{< feature-state for_k8s_version="v1.23" state="alpha" >}}
281-
282-
If you enable the `PodAndContainerStatsFromCRI`
283-
[feature gate](/docs/reference/command-line-tools-reference/feature-gates/) in your
284-
cluster, and you use a container runtime that supports statistics access via
285-
{{< glossary_tooltip term_id="cri" text="Container Runtime Interface">}} (CRI), then
286-
the kubelet fetches Pod- and container-level metric data using CRI, and not via cadvisor.
248+
To learn about how the kubelet serves node metrics, and how you can access those via
249+
the Kubernetes API, read [Node Metrics Data](/docs/reference/instrumentation/node-metrics).

0 commit comments

Comments
 (0)