@@ -3,7 +3,6 @@ title: Kubernetes 系统组件指标
3
3
content_type : concept
4
4
weight : 70
5
5
---
6
-
7
6
<!--
8
7
title: Metrics For Kubernetes System Components
9
8
reviewers:
@@ -96,6 +95,7 @@ Alpha metric → Stable metric → Deprecated metric → Hidden metric → De
96
95
Alpha metrics have no stability guarantees. These metrics can be modified or deleted at any time.
97
96
98
97
Stable metrics are guaranteed to not change. This means:
98
+
99
99
* A stable metric without a deprecated signature will not be deleted or renamed
100
100
* A stable metric's type will not be modified
101
101
@@ -263,6 +263,7 @@ lack of resources, and compare actual usage to the pod's request.
263
263
The kube-scheduler identifies the resource [requests and limits](/docs/concepts/configuration/manage-resources-containers/)
264
264
configured for each Pod; when either a request or limit is non-zero, the kube-scheduler reports a
265
265
metrics timeseries. The time series is labelled by:
266
+
266
267
- namespace
267
268
- pod name
268
269
- the node where the pod is scheduled or an empty string if not yet scheduled
@@ -275,6 +276,7 @@ kube-scheduler 组件能够辩识各个 Pod 所配置的资源
275
276
[ 请求和约束] ( /zh-cn/docs/concepts/configuration/manage-resources-containers/ ) 。
276
277
在 Pod 的资源请求值或者约束值非零时,kube-scheduler 会以度量值时间序列的形式
277
278
生成报告。该时间序列值包含以下标签:
279
+
278
280
- 名字空间
279
281
- Pod 名称
280
282
- Pod 调度所处节点,或者当 Pod 未被调度时用空字符串表示
@@ -291,7 +293,7 @@ The two metrics are called `kube_pod_resource_request` and `kube_pod_resource_li
291
293
292
294
The metrics are exposed at the HTTP endpoint `/metrics/resources` and require the same
293
295
authorization as the `/metrics` endpoint on the scheduler. You must use the
294
- `-show-hidden-metrics-for-version=1.20` flag to expose these alpha stability metrics.
296
+ `-- show-hidden-metrics-for-version=1.20` flag to expose these alpha stability metrics.
295
297
-->
296
298
一旦 Pod 进入完成状态(其 ` restartPolicy ` 为 ` Never ` 或 ` OnFailure ` ,且
297
299
其处于 ` Succeeded ` 或 ` Failed ` Pod 阶段,或者已经被删除且所有容器都具有
@@ -320,26 +322,33 @@ disabled metrics (i.e. `--disabled-metrics=metric1,metric2`).
320
322
## Metric cardinality enforcement
321
323
322
324
Metrics with unbounded dimensions could cause memory issues in the components they instrument. To
323
- limit resource use, you can use the `--allow-label-value ` command line option to dynamically
325
+ limit resource use, you can use the `--allow-metric-labels ` command line option to dynamically
324
326
configure an allow-list of label values for a metric.
327
+
328
+ In alpha stage, the flag can only take in a series of mappings as metric label allow-list.
329
+ Each mapping is of the format `<metric_name>,<label_name>=<allowed_labels>` where
330
+ `<allowed_labels>` is a comma-separated list of acceptable label names.
325
331
-->
326
332
## 指标顺序性保证 {#metric-cardinality-enforcement}
327
333
328
- 在 Alpha 阶段,标志只能接受一组映射值作为可以使用的指标标签。
334
+ 具有无限维度的指标可能会在其监控的组件中引起内存问题。
335
+ 为了限制资源使用,你可以使用 ` --allow-metric-labels ` 命令行选项来为指标动态配置允许的标签值列表。
336
+
337
+ 在 Alpha 阶段,此选项只能接受一组映射值作为可以使用的指标标签。
329
338
每个映射值的格式为` <指标名称>,<标签名称>=<可用标签列表> ` ,其中
330
339
` <可用标签列表> ` 是一个用逗号分隔的、可接受的标签名的列表。
331
340
332
341
<!--
333
342
The overall format looks like:
334
343
335
344
```
336
- --allow-label-value <metric_name>,<label_name>='<allow_value1>, <allow_value2>...', <metric_name2>,<label_name>='<allow_value1>, <allow_value2>...', ...
345
+ --allow-metric-labels <metric_name>,<label_name>='<allow_value1>, <allow_value2>...', <metric_name2>,<label_name>='<allow_value1>, <allow_value2>...', ...
337
346
```
338
347
-->
339
348
最终的格式看起来会是这样:
340
349
341
350
```
342
- --allow-label-value <指标名称>,<标签名称>='<可用值1>,<可用值2>...', <指标名称2>,<标签名称>='<可用值1>, <可用值2>...', ...
351
+ --allow-metric-labels <指标名称>,<标签名称>='<可用值1>,<可用值2>...', <指标名称2>,<标签名称>='<可用值1>, <可用值2>...', ...
343
352
```
344
353
345
354
<!--
@@ -348,7 +357,7 @@ Here is an example:
348
357
下面是一个例子:
349
358
350
359
``` none
351
- --allow-label-value number_count_metric,odd_number='1,3,5', number_count_metric,even_number='2,4,6', date_gauge_metric,weekend='Saturday,Sunday'
360
+ --allow-metric-labels number_count_metric,odd_number='1,3,5', number_count_metric,even_number='2,4,6', date_gauge_metric,weekend='Saturday,Sunday'
352
361
```
353
362
354
363
<!--
@@ -361,9 +370,8 @@ line argument to a component. Here's an example of the contents of that configur
361
370
以下是该配置文件的内容示例:
362
371
363
372
``` yaml
364
- allow-list :
365
- - " metric1,label2 " : " v1,v2,v3"
366
- - " metric2,label1 " : " v1,v2,v3"
373
+ " metric1,label2 " : " v1,v2,v3"
374
+ " metric2,label1 " : " v1,v2,v3"
367
375
` ` `
368
376
369
377
<!--
@@ -379,7 +387,9 @@ is encountered that is not allowed with respect to the allow-list constraints.
379
387
<!--
380
388
* Read about the [Prometheus text format](https://github.com/prometheus/docs/blob/master/content/docs/instrumenting/exposition_formats.md#text-based-format)
381
389
for metrics
390
+ * See the list of [stable Kubernetes metrics](https://github.com/kubernetes/kubernetes/blob/master/test/instrumentation/testdata/stable-metrics-list.yaml)
382
391
* Read about the [Kubernetes deprecation policy](/docs/reference/using-api/deprecation-policy/#deprecating-a-feature-or-behavior)
383
392
-->
384
393
* 阅读有关指标的 [Prometheus 文本格式](https://github.com/prometheus/docs/blob/master/content/docs/instrumenting/exposition_formats.md#text-based-format)
394
+ * 参阅[稳定的 Kubernetes 指标](https://github.com/kubernetes/kubernetes/blob/master/test/instrumentation/testdata/stable-metrics-list.yaml)的列表
385
395
* 阅读有关 [Kubernetes 弃用策略](/zh-cn/docs/reference/using-api/deprecation-policy/#deprecating-a-feature-or-behavior)
0 commit comments