Skip to content

Commit e1f4f07

Browse files
authored
Merge pull request #25809 from yuandongx/patch-8
[zh] sync /reference/using-api/_index.md
2 parents 6a7b301 + 0b80f45 commit e1f4f07

File tree

1 file changed

+223
-0
lines changed

1 file changed

+223
-0
lines changed

content/zh/docs/reference/using-api/_index.md

Lines changed: 223 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,226 @@
22
title: 使用 Kubernetes API
33
weight: 10
44
---
5+
6+
<!-- overview -->
7+
8+
<!--
9+
This section provides reference information for the Kubernetes API.
10+
-->
11+
本文提供了 Kubernetes API 的参考信息。
12+
13+
<!--
14+
The REST API is the fundamental fabric of Kubernetes. All operations and
15+
communications between components, and external user commands are REST API
16+
calls that the API Server handles. Consequently, everything in the Kubernetes
17+
platform is treated as an API object and has a corresponding entry in the
18+
[API](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/).
19+
-->
20+
REST API 是 Kubernetes 的基本结构。
21+
所有操作和组件之间的通信及外部用户命令都是调用 API 服务器处理的 REST API。
22+
因此,Kubernetes 平台视一切皆为 API 对象,
23+
且它们在 [API](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/) 中有相应的定义。
24+
25+
<!--
26+
The [Kubernetes API reference](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/)
27+
lists the API for Kubernetes version {{< param "version" >}}.
28+
-->
29+
[Kubernetes API 参考](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/)列
30+
出了 Kubernetes {{< param "version" >}} 版本的 API。
31+
32+
<!--
33+
For general background information, read
34+
[The Kubernetes API](/docs/concepts/overview/kubernetes-api/).
35+
[Controlling Access to the Kubernetes API](/docs/concepts/security/controlling-access/)
36+
describes how clients can authenticate to the Kubernetes API server, and how their
37+
requests are authorized.
38+
-->
39+
如需了解一般背景信息,请查阅 [Kubernetes API](/zh/docs/concepts/overview/kubernetes-api/)
40+
[Kubernetes API 控制访问](/zh/docs/concepts/security/controlling-access/)描述了客户端如何
41+
向 Kubernetes API 服务器进行身份认证以及他们的请求如何被鉴权。
42+
43+
44+
<!--
45+
## API versioning
46+
-->
47+
## API 版本控制
48+
49+
<!--
50+
The JSON and Protobuf serialization schemas follow the same guidelines for
51+
schema changes. The following descriptions cover both formats.
52+
-->
53+
JSON 和 Protobuf 序列化模式遵循相同的模式更改原则。
54+
以下描述涵盖了这两种格式。
55+
56+
<!--
57+
The API versioning and software versioning are indirectly related.
58+
The [API and release versioning proposal](https://git.k8s.io/community/contributors/design-proposals/release/versioning.md)
59+
describes the relationship between API versioning and software versioning.
60+
-->
61+
API 版本控制和软件版本控制是间接相关的。
62+
[API 和发布版本控制提案](https://git.k8s.io/community/contributors/design-proposals/release/versioning.md)
63+
描述了 API 版本控制和软件版本控制间的关系。
64+
65+
<!--
66+
Different API versions indicate different levels of stability and support. You
67+
can find more information about the criteria for each level in the
68+
[API Changes documentation](https://git.k8s.io/community/contributors/devel/sig-architecture/api_changes.md#alpha-beta-and-stable-versions).
69+
-->
70+
不同的 API 版本代表着不同的稳定性和支持级别。
71+
你可以在 [API 变更文档]https://git.k8s.io/community/contributors/devel/sig-architecture/api_changes.md#alpha-beta-and-stable-versions)
72+
中查看到更多的不同级别的判定标准。
73+
74+
<!--
75+
Here's a summary of each level:
76+
-->
77+
下面是每个级别的摘要:
78+
79+
<--
80+
- Alpha:
81+
- The version names contain `alpha` (for example, `v1alpha1`).
82+
- The software may contain bugs. Enabling a feature may expose bugs. A
83+
feature may be disabled by default.
84+
- The support for a feature may be dropped at any time without notice.
85+
- The API may change in incompatible ways in a later software release without notice.
86+
- The software is recommended for use only in short-lived testing clusters,
87+
due to increased risk of bugs and lack of long-term support.
88+
-->
89+
- Alpha:
90+
- 版本名称包含 `alpha`(例如,`v1alpha1`)。
91+
- 软件可能会有 Bug。启用某个特性可能会暴露出 Bug。
92+
某些特性可能默认禁用。
93+
- 对某个特性的支持可能会随时被删除,恕不另行通知。
94+
- API 可能在以后的软件版本中以不兼容的方式更改,恕不另行通知。
95+
- 由于缺陷风险增加和缺乏长期支持,建议该软件仅用于短期测试集群。
96+
97+
<!--
98+
- Beta:
99+
- The version names contain `beta` (for example, `v2beta3`).
100+
- The software is well tested. Enabling a feature is considered safe.
101+
Features are enabled by default.
102+
- The support for a feature will not be dropped, though the details may change.
103+
-->
104+
- Beta:
105+
- 版本名称包含 `beta` (例如, `v2beta3`)。
106+
- 软件被很好的测试过。启用某个特性被认为是安全的。
107+
特性默认开启。
108+
- 尽管一些特性会发生细节上的变化,但它们将会被长期支持。
109+
110+
<!--
111+
- The schema and/or semantics of objects may change in incompatible ways in
112+
a subsequent beta or stable release. When this happens, migration
113+
instructions are provided. Schema changes may require deleting, editing, and
114+
re-creating API objects. The editing process may not be straightforward.
115+
The migration may require downtime for applications that rely on the feature.
116+
- The software is not recommended for production uses. Subsequent releases
117+
may introduce incompatible changes. If you have multiple clusters which
118+
can be upgraded independently, you may be able to relax this restriction.
119+
-->
120+
- 在随后的 Beta 版或稳定版中,对象的模式和(或)语义可能以不兼容的方式改变。
121+
当这种情况发生时,将提供迁移说明。
122+
模式更改可能需要删除、编辑和重建 API 对象。
123+
编辑过程可能并不简单。
124+
对于依赖此功能的应用程序,可能需要停机迁移。
125+
- 该版本的软件不建议生产使用。
126+
后续发布版本可能会有不兼容的变动。
127+
如果你有多个集群可以独立升级,可以放宽这一限制。
128+
129+
<!--
130+
Please try beta features and provide feedback. After the features exit beta, it
131+
may not be practical to make more changes.
132+
-->
133+
{{< note >}}
134+
请试用测试版特性时并提供反馈。特性完成 Beta 阶段测试后,
135+
就可能不会有太多的变更了。
136+
{{< /note >}}
137+
138+
<!--
139+
- Stable:
140+
- The version name is `vX` where `X` is an integer.
141+
- The stable versions of features appear in released software for many subsequent versions.
142+
-->
143+
- Stable:
144+
- 版本名称如 `vX`,其中 `X` 为整数。
145+
- 特性的稳定版本会出现在后续很多版本的发布软件中。
146+
147+
<!--## API groups-->
148+
## API 组
149+
150+
<!--
151+
[API groups](https://git.k8s.io/community/contributors/design-proposals/api-machinery/api-group.md)
152+
make it easier to extend the Kubernetes API.
153+
The API group is specified in a REST path and in the `apiVersion` field of a
154+
serialized object.
155+
-->
156+
[API 组](https://git.k8s.io/community/contributors/design-proposals/api-machinery/api-group.md)
157+
能够简化对 Kubernetes API 的扩展。
158+
API 组信息出现在REST 路径中,也出现在序列化对象的 `apiVersion` 字段中。
159+
160+
<!--
161+
There are several API groups in Kubernetes:
162+
163+
* The *core* (also called *legacy*) group is found at REST path `/api/v1`.
164+
The core group is not specified as part of the `apiVersion` field, for
165+
example, `apiVersion: v1`.
166+
* The named groups are at REST path `/apis/$GROUP_NAME/$VERSION` and use
167+
`apiVersion: $GROUP_NAME/$VERSION` (for example, `apiVersion: batch/v1`).
168+
You can find the full list of supported API groups in
169+
[Kubernetes API reference](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#-strong-api-groups-strong-).
170+
-->
171+
以下是 Kubernetes 中的几个组:
172+
* *核心*(也叫 *legacy*)组的 REST 路径为 `/api/v1`
173+
核心组并不作为 `apiVersion` 字段的一部分,例如, `apiVersion: v1`
174+
* 指定的组位于 REST 路径 `/apis/$GROUP_NAME/$VERSION`
175+
并且使用 `apiVersion: $GROUP_NAME/$VERSION` (例如, `apiVersion: batch/v1`)。
176+
你可以在 [Kubernetes API 参考文档](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#-strong-api-groups-strong-)
177+
中查看全部的 API 组。
178+
179+
<!--
180+
## Enabling or disabling API groups {#enabling-or-disabling}
181+
182+
Certain resources and API groups are enabled by default. You can enable or
183+
disable them by setting `--runtime-config` on the API server. The
184+
`--runtime-config` flag accepts comma separated `<key>[=<value>]` pairs
185+
describing the runtime configuration of the API server. If the `=<value>`
186+
part is omitted, it is treated as if `=true` is specified. For example:
187+
188+
- to disable `batch/v1`, set `--runtime-config=batch/v1=false`
189+
- to enable `batch/v2alpha1`, set `--runtime-config=batch/v2alpha1`
190+
-->
191+
## 启用或禁用 API 组 {#enabling-or-disabling}
192+
资源和 API 组是在默认情况下被启用的。
193+
你可以通过在 API 服务器上设置 `--runtime-config` 参数来启用或禁用它们。
194+
`--runtime-config` 参数接受逗号分隔的 `<key>[=<value>]` 对,
195+
来描述 API 服务器的运行时配置。如果省略了 `=<value>` 部分,那么视其指定为 `=true`
196+
例如:
197+
- 禁用 `batch/v1`, 对应参数设置 `--runtime-config=batch/v1=false`
198+
- 启用 `batch/v2alpha1`, 对应参数设置 `--runtime-config=batch/v2alpha1`
199+
200+
<!--
201+
When you enable or disable groups or resources, you need to restart the API
202+
server and controller manager to pick up the `--runtime-config` changes.
203+
-->
204+
{{< note >}}
205+
启用或禁用组或资源时,
206+
你需要重启 API 服务器和控制器管理器来使 `--runtime-config` 生效。
207+
{{< /note >}}
208+
209+
<!--
210+
## Persistence
211+
-->
212+
## 持久化
213+
214+
<!--
215+
Kubernetes stores its serialized state in terms of the API resources by writing them into
216+
-->
217+
Kubernetes 通过 API 资源来将序列化的状态写到 {{< glossary_tooltip term_id="etcd" >}} 中存储。
218+
219+
## {{% heading "whatsnext" %}}
220+
221+
<!--
222+
- Learn more about [API conventions](https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#api-conventions)
223+
- Read the design documentation for
224+
[aggregator](https://github.com/kubernetes/community/blob/master/contributors/design-proposals/api-machinery/aggregated-api-servers.md)
225+
-->
226+
- 进一步了解 [API 惯例](https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#api-conventions)
227+
- 阅读 [聚合器](https://github.com/kubernetes/community/blob/master/contributors/design-proposals/api-machinery/aggregated-api-servers.md)

0 commit comments

Comments
 (0)