Skip to content

Commit a00215d

Browse files
authored
Merge pull request #37980 from sftim/20221119_split_out_kubelet_instrumentation_reference
Split out kubelet instrumentation details into reference page
2 parents 8121620 + 27550bc commit a00215d

File tree

3 files changed

+72
-23
lines changed

3 files changed

+72
-23
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 & 23 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,26 +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-
### Summary API source
247-
248-
The [kubelet](/docs/reference/command-line-tools-reference/kubelet/) gathers stats at the node,
249-
volume, pod and container level, and emits this information in
250-
the [Summary API](https://github.com/kubernetes/kubernetes/blob/7d309e0104fedb57280b261e5677d919cb2a0e2d/staging/src/k8s.io/kubelet/pkg/apis/stats/v1alpha1/types.go)
251-
for consumers to read.
252-
253-
Here is an example of a Summary API request for a `minikube` node:
254-
255-
```shell
256-
kubectl get --raw "/api/v1/nodes/minikube/proxy/stats/summary"
257-
```
258-
259-
Here is the same API call using `curl`:
260-
261-
```shell
262-
curl http://localhost:8080/api/v1/nodes/minikube/proxy/stats/summary
263-
```
264-
265-
{{< note >}}
266-
The summary API `/stats/summary` endpoint will be replaced by the `/metrics/resource` endpoint
267-
beginning with metrics-server 0.6.x.
268-
{{< /note >}}
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)