Skip to content

Commit c368570

Browse files
committed
[zh] sync using-api/api-concepts.md
1 parent 2842c49 commit c368570

File tree

1 file changed

+16
-11
lines changed

1 file changed

+16
-11
lines changed

content/zh-cn/docs/reference/using-api/api-concepts.md

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ API concepts:
6666
## Kubernetes API 术语 {#standard-api-terminology}
6767

6868
Kubernetes 通常使用常见的 RESTful 术语来描述 API 概念:
69+
6970
* **资源类型(Resource Type)** 是 URL 中使用的名称(`pods``namespaces``services`
7071
* 所有资源类型都有一个具体的表示(它们的对象模式),称为 **类别(Kind)**
7172
* 资源类型的实例的列表称为 **集合(Collection)**
@@ -103,12 +104,10 @@ of a given kind can have a given name at a time. However, if you delete the obje
103104
you can make a new object with the same name. Some objects are not namespaced (for
104105
example: Nodes), and so their names must be unique across the whole cluster.
105106
-->
106-
107107
### 对象名字 {#object-names}
108108

109109
你可以通过 API 创建的所有对象都有一个唯一的{{< glossary_tooltip text="名字" term_id="name" >}},
110-
以允许幂等创建和检索,
111-
但如果虚拟资源类型不可检索或不依赖幂等性,则它们可能没有唯一名称。
110+
以允许幂等创建和检索,但如果虚拟资源类型不可检索或不依赖幂等性,则它们可能没有唯一名称。
112111
在{{< glossary_tooltip text="名字空间" term_id="namespace" >}}内,
113112
同一时刻只能有一个给定类别的对象具有给定名称。
114113
但是,如果你删除该对象,你可以创建一个具有相同名称的新对象。
@@ -164,7 +163,7 @@ Examples:
164163
名字空间作用域的资源类型会在其名字空间被删除时也被删除,
165164
并且对该资源类型的访问是由定义在名字空间域中的授权检查来控制的。
166165

167-
注意: 核心资源使用 `/api` 而不是 `/apis`,并且不包含 GROUP 路径段。
166+
注意:核心资源使用 `/api` 而不是 `/apis`,并且不包含 GROUP 路径段。
168167

169168
例如:
170169

@@ -301,6 +300,7 @@ Kubernetes API 默认使用 [JSON](https://www.json.org/json-en.html) 来编码
301300
… JSON encoded collection of Pods (PodList object)
302301
```
303302
-->
303+
304304
```
305305
200 OK
306306
Content-Type: application/json
@@ -321,6 +321,7 @@ Kubernetes API 默认使用 [JSON](https://www.json.org/json-en.html) 来编码
321321
… JSON encoded Pod object
322322
```
323323
-->
324+
324325
```http
325326
POST /api/v1/namespaces/test/pods
326327
Content-Type: application/json
@@ -364,7 +365,7 @@ Kubernetes 还支持 [`application/yaml`](https://www.rfc-editor.org/rfc/rfc9512
364365
GET /api/v1/pods
365366
Accept: application/yaml
366367
```
367-
368+
368369
<!--
369370
```
370371
200 OK
@@ -373,6 +374,7 @@ Kubernetes 还支持 [`application/yaml`](https://www.rfc-editor.org/rfc/rfc9512
373374
… YAML encoded collection of Pods (PodList object)
374375
```
375376
-->
377+
376378
```
377379
200 OK
378380
Content-Type: application/yaml
@@ -393,6 +395,7 @@ Kubernetes 还支持 [`application/yaml`](https://www.rfc-editor.org/rfc/rfc9512
393395
… YAML encoded Pod object
394396
```
395397
-->
398+
396399
```http
397400
POST /api/v1/namespaces/test/pods
398401
Content-Type: application/yaml
@@ -449,14 +452,15 @@ For example:
449452
200 OK
450453
Content-Type: application/vnd.kubernetes.protobuf
451454
452-
JSON encoded collection of Pods (PodList object)
455+
binary encoded collection of Pods (PodList object)
453456
```
454457
-->
458+
455459
```
456460
200 OK
457461
Content-Type: application/vnd.kubernetes.protobuf
458462
459-
JSON 编码的 Pod 集合(PodList 对象)
463+
二进制编码的 Pod 集合(PodList 对象)
460464
```
461465

462466
<!--
@@ -473,6 +477,7 @@ For example:
473477
… binary encoded Pod object
474478
```
475479
-->
480+
476481
```http
477482
POST /api/v1/namespaces/test/pods
478483
Content-Type: application/vnd.kubernetes.protobuf
@@ -995,8 +1000,7 @@ resources in the result and include a `continue` value if there are more resourc
9951000
in the collection.
9961001
-->
9971002
你可以请求 API 服务器通过使用页(Kubernetes 将其称为“块(Chunk)”)的方式来处理 **list**
998-
完成单个集合的响应。
999-
要以块的形式检索单个集合,针对集合的请求支持两个查询参数 `limit``continue`
1003+
完成单个集合的响应。要以块的形式检索单个集合,针对集合的请求支持两个查询参数 `limit``continue`
10001004
并且从集合元 `metadata` 字段中的所有 **list** 操作返回响应字段 `continue`
10011005
客户端应该指定他们希望在每个带有 `limit` 的块中接收的条目数上限,如果集合中有更多资源,
10021006
服务器将在结果中返回 `limit` 资源并包含一个 `continue` 值。
@@ -1146,7 +1150,7 @@ each item in that collection represents a single Service. For example:
11461150
-->
11471151
## 集合 {#collections}
11481152

1149-
在 Kubernetes 术语中,你从 **list** 中获得的响应是一个“集合(Collections)”。
1153+
在 Kubernetes 术语中,你从 **list** 中获得的响应是一个“集合(Collection)”。
11501154
然而,Kubernetes 为不同类型资源的集合定义了具体类型。
11511155
集合的类别名是针对资源类别的,并附加了 `List`
11521156

@@ -1200,6 +1204,7 @@ Kubernetes API 中定义了数十种集合类型(如 `PodList`、`ServiceList`
12001204
```shell
12011205
kubectl get services -A -o yaml
12021206
```
1207+
12031208
```yaml
12041209
apiVersion: v1
12051210
kind: List
@@ -1368,7 +1373,7 @@ When you **delete** a resource this takes place in two phases.
13681373
13691374
当你 **delete** 资源时,操作将分两个阶段进行。
13701375
1371-
1. 终结(finalization)
1376+
1. **终结(finalization)**
13721377
2. 移除
13731378
13741379
```yaml

0 commit comments

Comments
 (0)