Skip to content

Commit 2e17822

Browse files
authored
Merge pull request #43208 from asa3311/sync-zh-66
[zh] sync /working-with-objects/_index.md annotations field-selectors
2 parents 8d17471 + ed866d2 commit 2e17822

File tree

3 files changed

+40
-16
lines changed

3 files changed

+40
-16
lines changed

content/zh-cn/docs/concepts/overview/working-with-objects/_index.md

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ Kubernetes 系统,你想要的集群工作负载状态看起来应是什么样
6868
这就是 Kubernetes 集群所谓的**期望状态(Desired State)**
6969

7070
<!--
71-
To work with Kubernetes objects--whether to create, modify, or delete them--you'll need to use the
71+
To work with Kubernetes objectswhether to create, modify, or delete themyou'll need to use the
7272
[Kubernetes API](/docs/concepts/overview/kubernetes-api/). When you use the `kubectl` command-line
7373
interface, for example, the CLI makes the necessary Kubernetes API calls for you. You can also use
7474
the Kubernetes API directly in your own programs using one of the
@@ -139,32 +139,36 @@ For more information on the object spec, status, and metadata, see the
139139
When you create an object in Kubernetes, you must provide the object spec that describes its
140140
desired state, as well as some basic information about the object (such as a name). When you use
141141
the Kubernetes API to create the object (either directly or via `kubectl`), that API request must
142-
include that information as JSON in the request body. **Most often, you provide the information to
143-
`kubectl` in a .yaml file.** `kubectl` converts the information to JSON when making the API
144-
request.
142+
include that information as JSON in the request body.
143+
Most often, you provide the information to `kubectl` in file known as a _manifest_.
144+
By convention, manifests are YAML (you could also use JSON format).
145+
Tools such as `kubectl` convert the information from a manifest into JSON or another supported
146+
serialization format when making the API request over HTTP.
145147
-->
146148
### 描述 Kubernetes 对象 {#describing-a-kubernetes-object}
147149

148150
创建 Kubernetes 对象时,必须提供对象的 `spec`,用来描述该对象的期望状态,
149151
以及关于对象的一些基本信息(例如名称)。
150152
当使用 Kubernetes API 创建对象时(直接创建或经由 `kubectl` 创建),
151153
API 请求必须在请求主体中包含 JSON 格式的信息。
152-
**大多数情况下,你需要提供 `.yaml` 文件为 kubectl 提供这些信息**
153-
`kubectl` 在发起 API 请求时,将这些信息转换成 JSON 格式。
154-
154+
大多数情况下,你会通过 **清单(Manifest)** 文件为 `kubectl` 提供这些信息。
155+
按照惯例,清单是 YAML 格式的(你也可以使用 JSON 格式)。
156+
`kubectl` 这样的工具在通过 HTTP 进行 API 请求时,
157+
会将清单中的信息转换为 JSON 或其他受支持的序列化格式。
155158
<!--
156-
Here's an example `.yaml` file that shows the required fields and object spec for a Kubernetes Deployment:
159+
Here's an example manifest that shows the required fields and object spec for a Kubernetes
160+
Deployment:
157161
-->
158-
这里有一个 `.yaml` 示例文件,展示了 Kubernetes Deployment 的必需字段和对象 `spec`
162+
这里有一个清单示例文件,展示了 Kubernetes Deployment 的必需字段和对象 `spec`
159163

160-
{{< code file="application/deployment.yaml" >}}
164+
{{% code_sample file="application/deployment.yaml" %}}
161165

162166
<!--
163-
One way to create a Deployment using a `.yaml` file like the one above is to use the
167+
One way to create a Deployment using a manifest file like the one above is to use the
164168
[`kubectl apply`](/docs/reference/generated/kubectl/kubectl-commands#apply) command
165169
in the `kubectl` command-line interface, passing the `.yaml` file as an argument. Here's an example:
166170
-->
167-
相较于上面使用 `.yaml` 文件来创建 Deployment,另一种类似的方式是使用 `kubectl` 命令行接口(CLI)中的
171+
与上面使用清单文件来创建 Deployment 类似,另一种方式是使用 `kubectl` 命令行接口(CLI)
168172
[`kubectl apply`](/docs/reference/generated/kubectl/kubectl-commands#apply) 命令,
169173
`.yaml` 文件作为参数。下面是一个示例:
170174

@@ -184,7 +188,8 @@ deployment.apps/nginx-deployment created
184188
<!--
185189
### Required fields
186190
187-
In the `.yaml` file for the Kubernetes object you want to create, you'll need to set values for the following fields:
191+
In the manifest (YAML or JSON file) for the Kubernetes object you want to create, you'll need to set values for
192+
the following fields:
188193
189194
* `apiVersion` - Which version of the Kubernetes API you're using to create this object
190195
* `kind` - What kind of object you want to create
@@ -193,7 +198,7 @@ In the `.yaml` file for the Kubernetes object you want to create, you'll need to
193198
-->
194199
### 必需字段 {#required-fields}
195200

196-
在想要创建的 Kubernetes 对象所对应的 `.yaml` 文件中,需要配置的字段如下:
201+
在想要创建的 Kubernetes 对象所对应的清单(YAML 或 JSON 文件)中,需要配置的字段如下:
197202

198203
* `apiVersion` - 创建该对象所使用的 Kubernetes API 的版本
199204
* `kind` - 想要创建的对象的类别
@@ -304,6 +309,10 @@ If you're new to Kubernetes, read more about the following:
304309
* [Deployment](/docs/concepts/workloads/controllers/deployment/) objects.
305310
* [Controllers](/docs/concepts/architecture/controller/) in Kubernetes.
306311
* [kubectl](/docs/reference/kubectl/) and [kubectl commands](/docs/reference/generated/kubectl/kubectl-commands).
312+
313+
[Kubernetes Object Management](/docs/concepts/overview/working-with-objects/object-management/)
314+
explains how to use `kubectl` to manage objects.
315+
You might need to [install kubectl](/docs/tasks/tools/#kubectl) if you don't already have it available.
307316
-->
308317
如果你刚开始学习 Kubernetes,可以进一步阅读以下信息:
309318

@@ -313,6 +322,10 @@ If you're new to Kubernetes, read more about the following:
313322
* [kubectl](/zh-cn/docs/reference/kubectl/)
314323
[kubectl 命令](/docs/reference/generated/kubectl/kubectl-commands)
315324

325+
[Kubernetes 对象管理](/zh-cn/docs/concepts/overview/working-with-objects/object-management/)
326+
介绍了如何使用 `kubectl` 来管理对象。
327+
如果你还没有安装 `kubectl`,你可能需要[安装 kubectl](/zh-cn/docs/tasks/tools/#kubectl)
328+
316329
<!--
317330
To learn about the Kubernetes API in general, visit:
318331

content/zh-cn/docs/concepts/overview/working-with-objects/annotations.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,8 @@ spec:
163163
## {{% heading "whatsnext" %}}
164164
165165
<!--
166-
Learn more about [Labels and Selectors](/docs/concepts/overview/working-with-objects/labels/).
166+
- Learn more about [Labels and Selectors](/docs/concepts/overview/working-with-objects/labels/).
167+
- Find [Well-known labels, Annotations and Taints](/docs/reference/labels-annotations-taints/)
167168
-->
168-
进一步了解[标签和选择算符](/zh-cn/docs/concepts/overview/working-with-objects/labels/)。
169+
- 进一步了解[标签和选择算符](/zh-cn/docs/concepts/overview/working-with-objects/labels/)。
170+
- 查找[众所周知的标签、注解和污点](/zh-cn/docs/reference/labels-annotations-taints/)。

content/zh-cn/docs/concepts/overview/working-with-objects/field-selectors.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,15 @@ You can use the `=`, `==`, and `!=` operators with field selectors (`=` and `==`
7878
kubectl get services --all-namespaces --field-selector metadata.namespace!=default
7979
```
8080

81+
{{< note >}}
82+
<!--
83+
[Set-based operators](/docs/concepts/overview/working-with-objects/labels/#set-based-requirement)
84+
(`in`, `notin`, `exists`) are not supported for field selectors.
85+
-->
86+
[基于集合的操作符](/zh-cn/docs/concepts/overview/working-with-objects/labels/#set-based-requirement)
87+
`in``notin``exists`)不支持字段选择算符。
88+
{{< /note >}}
89+
8190
<!--
8291
## Chained selectors
8392

0 commit comments

Comments
 (0)