website/content/zh-cn/docs/reference/command-line-tools-reference/feature-gates/index.md

226 lines
9.9 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

---
title: 特性门控
weight: 10
content_type: concept
card:
name: reference
weight: 60
---
<!--
title: Feature Gates
weight: 10
content_type: concept
card:
name: reference
weight: 60
-->
<!-- overview -->
<!--
This page contains an overview of the various feature gates an administrator
can specify on different Kubernetes components.
See [feature stages](#feature-stages) for an explanation of the stages for a feature.
-->
本页详述了管理员可以在不同的 Kubernetes 组件上指定的各种特性门控。
关于特性各个阶段的说明,请参见[特性阶段](#feature-stages)。
<!-- body -->
<!--
## Overview
Feature gates are a set of key=value pairs that describe Kubernetes features.
You can turn these features on or off using the `--feature-gates` command line flag
on each Kubernetes component.
-->
## 概述 {#overview}
特性门控是描述 Kubernetes 特性的一组键值对。你可以在 Kubernetes 的各个组件中使用
`--feature-gates` 标志来启用或禁用这些特性。
<!--
Each Kubernetes component lets you enable or disable a set of feature gates that
are relevant to that component.
Use `-h` flag to see a full set of feature gates for all components.
To set feature gates for a component, such as kubelet, use the `--feature-gates`
flag assigned to a list of feature pairs:
-->
每个 Kubernetes 组件都支持启用或禁用与该组件相关的一组特性门控。
使用 `-h` 参数来查看所有组件支持的完整特性门控。
要为诸如 kubelet 之类的组件设置特性门控,请使用 `--feature-gates` 参数,
并向其传递一个特性设置键值对列表:
```shell
--feature-gates=...,GracefulNodeShutdown=true
```
<!--
The following tables are a summary of the feature gates that you can set on
different Kubernetes components.
-->
下表总结了在不同的 Kubernetes 组件上可以设置的特性门控。
<!--
- The "Since" column contains the Kubernetes release when a feature is introduced
or its release stage is changed.
- The "Until" column, if not empty, contains the last Kubernetes release in which
you can still use a feature gate.
- If a feature is in the Alpha or Beta state, you can find the feature listed
in the [Alpha/Beta feature gate table](#feature-gates-for-alpha-or-beta-features).
- If a feature is stable you can find all stages for that feature listed in the
[Graduated/Deprecated feature gate table](#feature-gates-for-graduated-or-deprecated-features).
- The [Graduated/Deprecated feature gate table](#feature-gates-for-graduated-or-deprecated-features)
also lists deprecated and withdrawn features.
-->
- 引入特性或更改其发布阶段后,"开始Since" 列将包含 Kubernetes 版本。
- "结束Until" 列(如果不为空)包含最后一个 Kubernetes 版本,你仍可以在其中使用特性门控。
- 如果某个特性处于 Alpha 或 Beta 状态,你可以在
[Alpha 和 Beta 特性门控表](#feature-gates-for-alpha-or-beta-features)中找到该特性。
- 如果某个特性处于稳定状态,
你可以在[已毕业和废弃特性门控表](#feature-gates-for-graduated-or-deprecated-features)中找到该特性的所有阶段。
- [已毕业和废弃特性门控表](#feature-gates-for-graduated-or-deprecated-features)还列出了废弃的和已被移除的特性。
{{< note >}}
<!--
For a reference to old feature gates that are removed, please refer to
[feature gates removed](/docs/reference/command-line-tools-reference/feature-gates-removed/).
-->
有关已移除的原有特性门控的参考信息,
请参阅[已移除的特性门控](/zh-cn/docs/reference/command-line-tools-reference/feature-gates-removed/)。
{{< /note >}}
<!-- Want to edit this table? See https://k8s.io/docs/contribute/new-content/new-features/#ready-for-review-feature-gates -->
<!--
### Feature gates for Alpha or Beta features
-->
### Alpha 和 Beta 状态的特性门控 {#feature-gates-for-alpha-or-beta-features}
<!--
{{< feature-gate-table include="alpha,beta" caption="Feature gates for features in Alpha or Beta states" >}}
-->
{{< feature-gate-table include="alpha,beta" caption="处于 Alpha 或 Beta 状态的特性门控" >}}
<!-- Want to edit this table? See https://k8s.io/docs/contribute/new-content/new-features/#ready-for-review-feature-gates -->
<!--
### Feature gates for graduated or deprecated features
-->
### 已毕业和已废弃的特性门控 {#feature-gates-for-graduated-or-deprecated-features}
<!--
{{< feature-gate-table include="ga,deprecated" caption="Feature Gates for Graduated or Deprecated Features" >}}
-->
{{< feature-gate-table include="ga,deprecated" caption="已毕业或已废弃的特性门控" >}}
<!--
## Using a feature
### Feature stages
-->
## 使用特性 {#using-a-feature}
### 特性阶段 {#feature-stages}
<!--
A feature can be in *Alpha*, *Beta* or *GA* stage.
An *Alpha* feature means:
-->
处于 **Alpha**、**Beta**、**GA** 阶段的特性。
**Alpha** 特性代表:
<!--
* Disabled by default.
* Might be buggy. Enabling the feature may expose bugs.
* Support for feature may be dropped at any time without notice.
* The API may change in incompatible ways in a later software release without notice.
* Recommended for use only in short-lived testing clusters, due to increased
risk of bugs and lack of long-term support.
-->
* 默认禁用。
* 可能有错误,启用此特性可能会导致错误。
* 随时可能删除对此特性的支持,恕不另行通知。
* 在以后的软件版本中API 可能会以不兼容的方式更改,恕不另行通知。
* 建议将其仅用于短期测试中,因为开启特性会增加错误的风险,并且缺乏长期支持。
<!--
A *Beta* feature means:
-->
**Beta** 特性代表:
<!--
* Usually enabled by default. Beta API groups are
[disabled by default](https://github.com/kubernetes/enhancements/tree/master/keps/sig-architecture/3136-beta-apis-off-by-default).
* The feature is well tested. Enabling the feature is considered safe.
* Support for the overall feature will not be dropped, though details may change.
* The schema and/or semantics of objects may change in incompatible ways in a
subsequent beta or stable release. When this happens, we will provide instructions
for migrating to the next version. This may require deleting, editing, and
re-creating API objects. The editing process may require some thought.
This may require downtime for applications that rely on the feature.
* Recommended for only non-business-critical uses because of potential for
incompatible changes in subsequent releases. If you have multiple clusters
that can be upgraded independently, you may be able to relax this restriction.
-->
* 通常默认启用。Beta API 组[默认是被禁用的](https://github.com/kubernetes/enhancements/tree/master/keps/sig-architecture/3136-beta-apis-off-by-default)。
* 该特性已经经过良好测试。启用该特性是安全的。
* 尽管详细信息可能会更改,但不会放弃对整体特性的支持。
* 对象的架构或语义可能会在随后的 Beta 或稳定版本中以不兼容的方式更改。
当发生这种情况时,我们将提供迁移到下一版本的说明。此特性可能需要删除、编辑和重新创建 API 对象。
编辑过程可能需要慎重操作,因为这可能会导致依赖该特性的应用程序停机。
* 推荐仅用于非关键业务用途,因为在后续版本中可能会发生不兼容的更改。如果你具有多个可以独立升级的,则可以放宽此限制。
{{< note >}}
<!--
Please do try *Beta* features and give feedback on them!
After they exit beta, it may not be practical for us to make more changes.
-->
请试用 **Beta** 特性并提供相关反馈!
一旦特性结束 Beta 状态,我们就不太可能再对特性进行大幅修改。
{{< /note >}}
<!--
A *General Availability* (GA) feature is also referred to as a *stable* feature. It means:
-->
**General Availability**GA特性也称为**稳定**特性,**GA** 特性代表着:
<!--
* The feature is always enabled; you cannot disable it.
* The corresponding feature gate is no longer needed.
* Stable versions of features will appear in released software for many subsequent versions.
-->
* 此特性会一直启用;你不能禁用它。
* 不再需要相应的特性门控。
* 对于许多后续版本,特性的稳定版本将出现在发行的软件中。
<!--
## List of feature gates {#feature-gates}
Each feature gate is designed for enabling/disabling a specific feature:
-->
### 特性门控列表 {#feature-gates}
每个特性门控均用于启用或禁用某个特定的特性:
<!-- Want to edit this list? See https://k8s.io/docs/contribute/new-content/new-features/#ready-for-review-feature-gates -->
{{< feature-gate-list include="alpha,beta,ga,deprecated" >}}
## {{% heading "whatsnext" %}}
<!--
* The [deprecation policy](/docs/reference/using-api/deprecation-policy/) for Kubernetes explains
the project's approach to removing features and components.
* Since Kubernetes 1.24, new beta APIs are not enabled by default. When enabling a beta
feature, you will also need to enable any associated API resources.
For example, to enable a particular resource like
`storage.k8s.io/v1beta1/csistoragecapacities`, set `--runtime-config=storage.k8s.io/v1beta1/csistoragecapacities`.
See [API Versioning](/docs/reference/using-api/#api-versioning) for more details on the command line flags.
-->
* Kubernetes 的[弃用策略](/zh-cn/docs/reference/using-api/deprecation-policy/)介绍了项目针对已移除特性和组件的处理方法。
* 从 Kubernetes 1.24 开始,默认不启用新的 Beta API。
启用 Beta 功能时,还需要启用所有关联的 API 资源。
例如:要启用一个特定资源,如 `storage.k8s.io/v1beta1/csistoragecapacities`
请设置 `--runtime-config=storage.k8s.io/v1beta1/csistoragecapacities`
有关命令行标志的更多详细信息,请参阅 [API 版本控制](/zh-cn/docs/reference/using-api/#api-versioning)。