[zh-cn] sync cluster-administration/flow-control.md system-metrics.md

Signed-off-by: xin.li <xin.li@daocloud.io>
pull/44391/head
xin.li 2023-12-16 22:05:15 +08:00
parent 409af7e430
commit 9b34cf6250
2 changed files with 55 additions and 46 deletions

View File

@ -13,7 +13,7 @@ weight: 110
<!-- overview -->
{{< feature-state state="beta" for_k8s_version="v1.20" >}}
{{< feature-state state="stable" for_k8s_version="v1.29" >}}
<!--
Controlling the behavior of the Kubernetes API server in an overload situation
@ -80,48 +80,38 @@ APF 适用于 **watch** 请求。当 APF 被禁用时,**watch** 请求不受 `
## 启用/禁用 API 优先级和公平性 {#enabling-api-priority-and-fairness}
<!--
The API Priority and Fairness feature is controlled by a feature gate
and is enabled by default. See [Feature
Gates](/docs/reference/command-line-tools-reference/feature-gates/)
for a general explanation of feature gates and how to enable and
disable them. The name of the feature gate for APF is
"APIPriorityAndFairness". This feature also involves an {{<
glossary_tooltip term_id="api-group" text="API Group" >}} with: (a) a
`v1alpha1` version and a `v1beta1` version, disabled by default, and
(b) `v1beta2` and `v1beta3` versions, enabled by default. You can
disable the feature gate and API group beta versions by adding the
following command-line flags to your `kube-apiserver` invocation:
The API Priority and Fairness feature is controlled by a command-line flag
and is enabled by default. See
[Options](/docs/reference/command-line-tools-reference/kube-apiserver/options/)
for a general explanation of the available kube-apiserver command-line
options and how to enable and disable them. The name of the
command-line option for APF is "--enable-priority-and-fairness". This feature
also involves an {{<glossary_tooltip term_id="api-group" text="API Group" >}}
with: (a) a stable `v1` version, introduced in 1.29, and
enabled by default (b) a `v1beta3` version, enabled by default, and
deprecated in v1.29. You can
disable the API group beta version `v1beta3` by adding the
-->
API 优先级与公平性APF特性由特性门控控制,默认情况下启用。
有关特性门控的一般性描述以及如何启用和禁用特性门控
请参见[特性门控](/zh-cn/docs/reference/command-line-tools-reference/feature-gates/)。
APF 的特性门控称为 `APIPriorityAndFairness`
API 优先级与公平性APF特性由命令行标志控制,默认情况下启用。
有关可用 kube-apiserver 命令行参数以及如何启用和禁用的说明
请参见[参数](/zh-cn/docs/reference/command-line-tools-reference/kube-apiserver/options/)。
APF 的命令行参数是 "--enable-priority-and-fairness"
此特性也与某个 {{< glossary_tooltip term_id="api-group" text="API 组" >}}相关:
(a) `v1alpha1``v1beta1` 版本,默认被禁用;
(b) `v1beta2` 和 `v1beta3` 版本,默认被启用。
你可以在启动 `kube-apiserver` 时,添加以下命令行标志来禁用此功能门控及 API Beta 组:
(a) 稳定的 `v1` 版本,在 1.29 中引入,默认启用;
(b) `v1beta3` 版本,默认被启用,在 1.29 中被弃用。
你可以通过添加以下内容来禁用 Beta 版的 `v1beta3` API 组:
```shell
kube-apiserver \
--feature-gates=APIPriorityAndFairness=false \
--runtime-config=flowcontrol.apiserver.k8s.io/v1beta2=false,flowcontrol.apiserver.k8s.io/v1beta3=false \
--runtime-config=flowcontrol.apiserver.k8s.io/v1beta3=false \
# ...其他配置不变
```
<!--
Alternatively, you can enable the v1alpha1 and v1beta1 versions of the API group
with `--runtime-config=flowcontrol.apiserver.k8s.io/v1alpha1=true,flowcontrol.apiserver.k8s.io/v1beta1=true`.
-->
或者,你也可以通过
`--runtime-config=flowcontrol.apiserver.k8s.io/v1alpha1=true,flowcontrol.apiserver.k8s.io/v1beta1=true`
启用 API 组的 v1alpha1 和 v1beta1 版本。
<!--
The command-line flag `--enable-priority-and-fairness=false` will disable the
API Priority and Fairness feature, even if other flags have enabled it.
API Priority and Fairness feature.
-->
命令行标志 `--enable-priority-fairness=false` 将彻底禁用 APF 特性,
即使其他标志启用它也是无效。
命令行标志 `--enable-priority-fairness=false` 将彻底禁用 APF 特性。
<!--
## Concepts
@ -312,23 +302,20 @@ server.
## Resources
The flow control API involves two kinds of resources.
[PriorityLevelConfigurations](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#prioritylevelconfiguration-v1beta2-flowcontrol-apiserver-k8s-io)
[PriorityLevelConfigurations](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#prioritylevelconfiguration-v1-flowcontrol-apiserver-k8s-io)
define the available priority levels, the share of the available concurrency
budget that each can handle, and allow for fine-tuning queuing behavior.
[FlowSchemas](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#flowschema-v1beta2-flowcontrol-apiserver-k8s-io)
[FlowSchemas](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#flowschema-v1-flowcontrol-apiserver-k8s-io)
are used to classify individual inbound requests, matching each to a
single PriorityLevelConfiguration. There is also a `v1alpha1` version
of the same API group, and it has the same Kinds with the same syntax and
semantics.
single PriorityLevelConfiguration.
-->
## 资源 {#resources}
流控 API 涉及两种资源。
[PriorityLevelConfiguration](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#prioritylevelconfiguration-v1beta2-flowcontrol-apiserver-k8s-io)
[PriorityLevelConfiguration](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#prioritylevelconfiguration-v1-flowcontrol-apiserver-k8s-io)
定义可用的优先级和可处理的并发预算量,还可以微调排队行为。
[FlowSchema](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#flowschema-v1beta2-flowcontrol-apiserver-k8s-io)
[FlowSchema](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#flowschema-v1-flowcontrol-apiserver-k8s-io)
用于对每个入站请求进行分类,并与一个 PriorityLevelConfiguration 相匹配。
此外同一 API 组还有一个 `v1alpha1` 版本,其中包含语法和语义都相同的资源类别。
<!--
### PriorityLevelConfiguration

View File

@ -25,8 +25,8 @@ This format is structured plain text, designed so that people and machines can b
-->
通过系统组件指标可以更好地了解系统组个内部发生的情况。系统组件指标对于构建仪表板和告警特别有用。
Kubernetes 组件以 [Prometheus 格式](https://prometheus.io/docs/instrumenting/exposition_formats/)
生成度量值。
Kubernetes 组件以
[Prometheus 格式](https://prometheus.io/docs/instrumenting/exposition_formats/)生成度量值。
这种格式是结构化的纯文本,旨在使人和机器都可以阅读。
<!-- body -->
@ -65,7 +65,7 @@ If your cluster uses {{< glossary_tooltip term_id="rbac" text="RBAC" >}}, readin
authorization via a user, group or ServiceAccount with a ClusterRole that allows accessing
`/metrics`. For example:
-->
在生产环境中,你可能需要配置 [Prometheus 服务器](https://prometheus.io/)
在生产环境中,你可能需要配置 [Prometheus 服务器](https://prometheus.io/)或
某些其他指标搜集器以定期收集这些指标,并使它们在某种时间序列数据库中可用。
请注意,{{< glossary_tooltip term_id="kubelet" text="kubelet" >}} 还会在 `/metrics/cadvisor`
@ -255,10 +255,9 @@ of all running pods. These metrics can be used to build capacity planning dashbo
current or historical scheduling limits, quickly identify workloads that cannot schedule due to
lack of resources, and compare actual usage to the pod's request.
-->
调度器会暴露一些可选的指标,报告所有运行中 Pods 所请求的资源和期望的约束值。
调度器会暴露一些可选的指标,报告所有运行中 Pod 所请求的资源和期望的约束值。
这些指标可用来构造容量规划监控面板、访问调度约束的当前或历史数据、
快速发现因为缺少资源而无法被调度的负载,或者将 Pod 的实际资源用量
与其请求值进行比较。
快速发现因为缺少资源而无法被调度的负载,或者将 Pod 的实际资源用量与其请求值进行比较。
<!--
The kube-scheduler identifies the resource [requests and limits](/docs/concepts/configuration/manage-resources-containers/)
@ -352,6 +351,29 @@ Here is an example:
--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'
```
<!--
In addition to specifying this from the CLI, this can also be done within a configuration file. You
can specify the path to that configuration file using the `--allow-metric-labels-manifest` command
line argument to a component. Here's an example of the contents of that configuration file:
-->
除了从 CLI 中指定之外,还可以在配置文件中完成此操作。
你可以使用组件的 `--allow-metric-labels-manifest` 命令行参数指定该配置文件的路径。
以下是该配置文件的内容示例:
```yaml
allow-list:
- "metric1,label2": "v1,v2,v3"
- "metric2,label1": "v1,v2,v3"
```
<!--
Additionally, the `cardinality_enforcement_unexpected_categorizations_total` meta-metric records the
count of unexpected categorizations during cardinality enforcement, that is, whenever a label value
is encountered that is not allowed with respect to the allow-list contraints.
-->
此外,`cardinality_enforcement_unexpected_categorizations_total`
元指标记录基数执行期间意外分类的计数,即每当遇到允许列表约束不允许的标签值时。
## {{% heading "whatsnext" %}}
<!--