Skip to content

Commit 4d50f0d

Browse files
authored
Merge pull request #50635 from windsonsea/temtri
[zh] Sync cluster-administration/system-metrics.md
2 parents 8477eac + 92de319 commit 4d50f0d

File tree

1 file changed

+83
-30
lines changed

1 file changed

+83
-30
lines changed

content/zh-cn/docs/concepts/cluster-administration/system-metrics.md

Lines changed: 83 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ Examples of those components:
4040
-->
4141
## Kubernetes 中组件的指标 {#metrics-in-kubernetes}
4242

43-
在大多数情况下,可以通过 HTTP 访问组件的 `/metrics` 端点来获取组件的度量值。
44-
对于那些默认情况下不暴露端点的组件,可以使用 `--bind-address` 标志启用
43+
在大多数情况下,可以通过 HTTP 服务器的 `/metrics` 端点来获取组件的度量值。
44+
对于那些默认情况下不暴露端点的组件,可以使用 `--bind-address` 参数来启用
4545

4646
这些组件的示例:
4747

@@ -64,16 +64,16 @@ If your cluster uses {{< glossary_tooltip term_id="rbac" text="RBAC" >}}, readin
6464
authorization via a user, group or ServiceAccount with a ClusterRole that allows accessing
6565
`/metrics`. For example:
6666
-->
67-
在生产环境中,你可能需要配置 [Prometheus 服务器](https://prometheus.io/)
68-
某些其他指标搜集器以定期收集这些指标,并使它们在某种时间序列数据库中可用。
67+
在生产环境中,你可能需要配置
68+
[Prometheus 服务器](https://prometheus.io/)或某些其他指标搜集器以定期收集这些指标,
69+
并使它们在某种时间序列数据库中可用。
6970

7071
请注意,{{< glossary_tooltip term_id="kubelet" text="kubelet" >}} 还会在 `/metrics/cadvisor`
7172
`/metrics/resource``/metrics/probes` 端点中公开度量值。这些度量值的生命周期各不相同。
7273

7374
如果你的集群使用了 {{< glossary_tooltip term_id="rbac" text="RBAC" >}},
7475
则读取指标需要通过基于用户、组或 ServiceAccount 的鉴权,要求具有允许访问
75-
`/metrics` 的 ClusterRole。
76-
例如:
76+
`/metrics` 的 ClusterRole。例如:
7777

7878
```yaml
7979
apiVersion: rbac.authorization.k8s.io/v1
@@ -164,26 +164,27 @@ The flag `show-hidden-metrics-for-version` takes a version for which you want to
164164
deprecated in that release. The version is expressed as x.y, where x is the major version, y is
165165
the minor version. The patch version is not needed even though a metrics can be deprecated in a
166166
patch release, the reason for that is the metrics deprecation policy runs against the minor release.
167-
168-
The flag can only take the previous minor version as it's value. All metrics hidden in previous
169-
will be emitted if admins set the previous version to `show-hidden-metrics-for-version`. The too
170-
old version is not allowed because this violates the metrics deprecated policy.
171-
172-
Take metric `A` as an example, here assumed that `A` is deprecated in 1.n. According to metrics
173-
deprecated policy, we can reach the following conclusion:
174167
-->
175168
## 显示隐藏指标 {#show-hidden-metrics}
176169

177170
如上所述,管理员可以通过设置可执行文件的命令行参数来启用隐藏指标,
178171
如果管理员错过了上一版本中已经弃用的指标的迁移,则可以把这个用作管理员的逃生门。
179172

180-
`show-hidden-metrics-for-version` 标志接受版本号作为取值,版本号给出
181-
你希望显示该发行版本中已弃用的指标
173+
`show-hidden-metrics-for-version` 参数接受版本号作为取值,
174+
版本号给出你希望显示该发行版本中已弃用的指标
182175
版本表示为 x.y,其中 x 是主要版本,y 是次要版本。补丁程序版本不是必须的,
183176
即使指标可能会在补丁程序发行版中弃用,原因是指标弃用策略规定仅针对次要版本。
184177

185-
该参数只能使用前一个次要版本。如果管理员将先前版本设置为 `show-hidden-metrics-for-version`
186-
则先前版本中隐藏的度量值会再度生成。不允许使用过旧的版本,因为那样会违反指标弃用策略。
178+
<!--
179+
The flag can only take the previous minor version as it's value. All metrics hidden in previous
180+
will be emitted if admins set the previous version to `show-hidden-metrics-for-version`. The too
181+
old version is not allowed because this violates the metrics deprecated policy.
182+
183+
Take metric `A` as an example, here assumed that `A` is deprecated in 1.n. According to metrics
184+
deprecated policy, we can reach the following conclusion:
185+
-->
186+
此参数的取值只能使用前一个次要版本。如果管理员将前一个版本设置为 `show-hidden-metrics-for-version`
187+
则前一个版本中隐藏的度量值会再度生成。不允许使用过旧的版本,因为那样会违反指标弃用策略。
187188

188189
以指标 `A` 为例,此处假设 `A` 在 1.n 中已弃用。根据指标弃用策略,我们可以得出以下结论:
189190

@@ -202,7 +203,7 @@ to remove this metric dependency before upgrading to `1.14`
202203
* 在版本 `1.n+2` 中,这个指标就将被从代码中移除,不会再有任何逃生窗口。
203204

204205
如果你要从版本 `1.12` 升级到 `1.13`,但仍依赖于 `1.12` 中弃用的指标 `A`,则应通过命令行设置隐藏指标:
205-
`--show-hidden-metrics=1.12`,并记住在升级到 `1.14` 版本之前删除此指标依赖项
206+
`--show-hidden-metrics=1.12`,并记住在升级到 `1.14` 版本之前移除此指标依赖项
206207

207208
<!--
208209
## Component metrics
@@ -213,12 +214,6 @@ Controller manager metrics provide important insight into the performance and he
213214
controller manager. These metrics include common Go language runtime metrics such as go_routine
214215
count and controller specific metrics such as etcd request latencies or Cloudprovider (AWS, GCE,
215216
OpenStack) API latencies that can be used to gauge the health of a cluster.
216-
217-
Starting from Kubernetes 1.7, detailed Cloudprovider metrics are available for storage operations
218-
for GCE, AWS, Vsphere and OpenStack.
219-
These metrics can be used to monitor health of persistent volume operations.
220-
221-
For example, for GCE these metrics are called:
222217
-->
223218
## 组件指标 {#component-metrics}
224219

@@ -228,6 +223,13 @@ For example, for GCE these metrics are called:
228223
这些指标包括通用的 Go 语言运行时指标(例如 go_routine 数量)和控制器特定的度量指标,
229224
例如可用于评估集群运行状况的 etcd 请求延迟或云提供商(AWS、GCE、OpenStack)的 API 延迟等。
230225

226+
<!--
227+
Starting from Kubernetes 1.7, detailed Cloudprovider metrics are available for storage operations
228+
for GCE, AWS, Vsphere and OpenStack.
229+
These metrics can be used to monitor health of persistent volume operations.
230+
231+
For example, for GCE these metrics are called:
232+
-->
231233
从 Kubernetes 1.7 版本开始,详细的云提供商指标可用于 GCE、AWS、Vsphere 和 OpenStack 的存储操作。
232234
这些指标可用于监控持久卷操作的运行状况。
233235

@@ -298,17 +300,68 @@ ClusterRole with the `get` verb for the `/metrics/resources` non-resource URL.
298300
On Kubernetes 1.21 you must use the `--show-hidden-metrics-for-version=1.20`
299301
flag to expose these alpha stability metrics.
300302
-->
301-
一旦 Pod 进入完成状态(其 `restartPolicy``Never``OnFailure`
302-
其处于 `Succeeded``Failed` Pod 阶段,或者已经被删除且所有容器都具有
303-
终止状态),该时间序列停止报告,因为调度器现在可以调度其它 Pod 来执行。
303+
一旦 Pod 进入完成状态(其 `restartPolicy``Never``OnFailure`且其处于
304+
`Succeeded``Failed` Pod 阶段,或者已经被删除且所有容器都具有终止状态),
305+
该时间序列停止报告,因为调度器现在可以调度其它 Pod 来执行。
304306
这两个指标称作 `kube_pod_resource_request``kube_pod_resource_limit`
305307

306308
这些指标通过 HTTP 端点 `/metrics/resources` 公开出来。
307309
访问 `/metrics/resources` 端点需要鉴权,通常通过对
308310
`/metrics/resources` 非资源 URL 的 `get` 访问授予访问权限。
309311

310312
在 Kubernetes 1.21 中,你必须使用 `--show-hidden-metrics-for-version=1.20`
311-
标志来公开 Alpha 级稳定性的指标。
313+
参数来公开 Alpha 级稳定性的指标。
314+
315+
<!--
316+
### kubelet Pressure Stall Information (PSI) metrics
317+
-->
318+
### kubelet 压力阻塞信息(PSI)指标
319+
320+
{{< feature-state for_k8s_version="v1.33" state="alpha" >}}
321+
322+
<!--
323+
As an alpha feature, Kubernetes lets you configure kubelet to collect Linux kernel
324+
[Pressure Stall Information](https://docs.kernel.org/accounting/psi.html)
325+
(PSI) for CPU, memory and IO usage.
326+
The information is collected at node, pod and container level.
327+
The metrics are exposed at the `/metrics/cadvisor` endpoint with the following names:
328+
-->
329+
作为一个 Alpha 阶段的特性,Kubernetes 允许你配置 kubelet 以基于 CPU、内存和 IO 的使用情况收集 Linux
330+
内核的[压力阻塞信息(PSI)](https://docs.kernel.org/accounting/psi.html)
331+
此信息是在节点、Pod 和容器级别进行收集的。
332+
这些指标通过 `/metrics/cadvisor` 端点暴露,指标名称如下:
333+
334+
```
335+
container_pressure_cpu_stalled_seconds_total
336+
container_pressure_cpu_waiting_seconds_total
337+
container_pressure_memory_stalled_seconds_total
338+
container_pressure_memory_waiting_seconds_total
339+
container_pressure_io_stalled_seconds_total
340+
container_pressure_io_waiting_seconds_total
341+
```
342+
343+
<!--
344+
You must enable the `KubeletPSI` [feature gate](/docs/reference/command-line-tools-reference/feature-gates/)
345+
to use this feature. The information is also exposed in the
346+
[Summary API](/docs/reference/instrumentation/node-metrics#psi).
347+
-->
348+
要使用此特性,你必须启用 `KubeletPSI` [特性门控](/zh-cn/docs/reference/command-line-tools-reference/feature-gates/)
349+
此信息也会通过 [Summary API](/zh-cn/docs/reference/instrumentation/node-metrics#psi) 暴露。
350+
351+
<!--
352+
#### Requirements
353+
354+
Pressure Stall Information requires:
355+
356+
- [Linux kernel versions 4.20 or later](/docs/reference/node/kernel-version-requirements#requirements-psi).
357+
- [cgroup v2](/docs/concepts/architecture/cgroups)
358+
-->
359+
#### 要求
360+
361+
启用压力阻塞信息需满足以下条件:
362+
363+
- [Linux 内核版本为 4.20 或更高](/zh-cn/docs/reference/node/kernel-version-requirements#requirements-psi)
364+
- [cgroup v2](/zh-cn/docs/concepts/architecture/cgroups)
312365

313366
<!--
314367
## Disabling metrics
@@ -319,9 +372,9 @@ disabled metrics (i.e. `--disabled-metrics=metric1,metric2`).
319372
-->
320373
## 禁用指标 {#disabling-metrics}
321374

322-
你可以通过命令行标志 `--disabled-metrics` 来关闭某指标。
375+
你可以通过命令行参数 `--disabled-metrics` 来关闭某指标。
323376
在例如某指标会带来性能问题的情况下,这一操作可能是有用的。
324-
标志的参数值是一组被禁止的指标(例如:`--disabled-metrics=metric1,metric2`)。
377+
参数值是一组被禁用的指标(例如:`--disabled-metrics=metric1,metric2`)。
325378

326379
<!--
327380
## Metric cardinality enforcement

0 commit comments

Comments
 (0)