Skip to content

Commit 0ed73f3

Browse files
committed
[zh] sync /using-api/api-concepts.md
1 parent 7ff4609 commit 0ed73f3

File tree

3 files changed

+79
-32
lines changed

3 files changed

+79
-32
lines changed

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

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,56 @@ Content-Type: application/json
469469
<followed by regular watch stream starting from resourceVersion="10245">
470470
```
471471

472+
<!--
473+
## Response compression
474+
-->
475+
## 响应压缩 {#response-compression}
476+
477+
{{< feature-state for_k8s_version="v1.16" state="beta" >}}
478+
479+
<!--
480+
`APIResponseCompression` is an option that allows the API server to compress the responses for **get**
481+
and **list** requests, reducing the network bandwidth and improving the performance of large-scale clusters.
482+
It is enabled by default since Kubernetes 1.16 and it can be disabled by including
483+
`APIResponseCompression=false` in the `--feature-gates` flag on the API server.
484+
-->
485+
`APIResponseCompression` 是一个选项,允许 API 服务器压缩 **get****list** 请求的响应,
486+
减少占用的网络带宽并提高大规模集群的性能。此选项自 Kubernetes 1.16 以来默认启用,
487+
可以通过在 API 服务器上的 `--feature-gates` 标志中包含 `APIResponseCompression=false` 来禁用。
488+
489+
<!--
490+
API response compression can significantly reduce the size of the response, especially for large resources or
491+
[collections](/docs/reference/using-api/api-concepts/#collections).
492+
For example, a **list** request for pods can return hundreds of kilobytes or even megabytes of data,
493+
depending on the number of pods and their attributes. By compressing the response, the network bandwidth
494+
can be saved and the latency can be reduced.
495+
-->
496+
特别是对于大型资源或[集合](/zh-cn/docs/reference/using-api/api-concepts/#collections)
497+
API 响应压缩可以显著减小其响应的大小。例如,针对 Pod 的 **list** 请求可能会返回数百 KB 甚至几 MB 的数据,
498+
具体大小取决于 Pod 数量及其属性。通过压缩响应,可以节省网络带宽并降低延迟。
499+
500+
<!--
501+
To verify if `APIResponseCompression` is working, you can send a **get** or **list** request to the
502+
API server with an `Accept-Encoding` header, and check the response size and headers. For example:
503+
-->
504+
要验证 `APIResponseCompression` 是否正常工作,你可以使用一个 `Accept-Encoding`
505+
头向 API 服务器发送一个 **get****list** 请求,并检查响应大小和头信息。例如:
506+
507+
```console
508+
GET /api/v1/pods
509+
Accept-Encoding: gzip
510+
---
511+
200 OK
512+
Content-Type: application/json
513+
content-encoding: gzip
514+
...
515+
```
516+
517+
<!--
518+
The `content-encoding` header indicates that the response is compressed with `gzip`.
519+
-->
520+
`content-encoding` 头表示响应使用 `gzip` 进行了压缩。
521+
472522
<!--
473523
## Retrieving large results sets in chunks
474524
-->

content/zh-cn/docs/reference/using-api/client-libraries.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ weight: 30
1717
This page contains an overview of the client libraries for using the Kubernetes
1818
API from various programming languages.
1919
-->
20-
本页面包含基于各种编程语言使用 Kubernetes API 的客户端库概述。
21-
20+
本页面概要介绍了基于各种编程语言使用 Kubernetes API 的客户端库。
2221

2322
<!-- body -->
2423
<!--
@@ -51,7 +50,8 @@ format to read the credentials and the API Server address.
5150
The following client libraries are officially maintained by
5251
[Kubernetes SIG API Machinery](https://github.com/kubernetes/community/tree/master/sig-api-machinery).
5352
-->
54-
以下客户端库由 [Kubernetes SIG API Machinery](https://github.com/kubernetes/community/tree/master/sig-api-machinery) 正式维护。
53+
以下客户端库由 [Kubernetes SIG API Machinery](https://github.com/kubernetes/community/tree/master/sig-api-machinery)
54+
正式维护。
5555

5656
<!--
5757
| Language | Client Library | Sample Programs |

content/zh-cn/docs/reference/using-api/deprecation-guide.md

Lines changed: 26 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ When APIs evolve, the old API is deprecated and eventually removed.
2323
This page contains information you need to know when migrating from
2424
deprecated API versions to newer and more stable API versions.
2525
-->
26-
随着 Kubernetes API 的演化,APIs 会周期性地被重组或升级。
27-
APIs 演化时,老的 API 会被弃用并被最终删除。
26+
随着 Kubernetes API 的演化,API 会周期性地被重组或升级。
27+
API 演化时,老的 API 会被弃用并被最终删除。
2828
本页面包含你在将已弃用 API 版本迁移到新的更稳定的 API 版本时需要了解的知识。
2929

3030
<!-- body -->
@@ -105,7 +105,7 @@ The **flowcontrol.apiserver.k8s.io/v1beta1** API version of FlowSchema and Prior
105105
* All existing persisted objects are accessible via the new API
106106
* No notable changes
107107
-->
108-
从 v1.26 版本开始不再提供 **flowcontrol.apiserver.k8s.io/v1beta1** API 版本的
108+
从 v1.26 版本开始不再提供 **flowcontrol.apiserver.k8s.io/v1beta1** API 版本的
109109
FlowSchema 和 PriorityLevelConfiguration。
110110

111111
* 迁移清单和 API 客户端使用 **flowcontrol.apiserver.k8s.io/v1beta3** API 版本,
@@ -148,7 +148,7 @@ The **batch/v1beta1** API version of CronJob is no longer served as of v1.25.
148148

149149
* 迁移清单和 API 客户端使用 **batch/v1** API 版本,此 API 从 v1.21 版本开始可用;
150150
* 所有的已保存的对象都可以通过新的 API 来访问;
151-
* 没有需要额外注意的变更
151+
* 没有需要额外注意的变更
152152

153153
#### EndpointSlice {#endpointslice-v125}
154154

@@ -218,15 +218,14 @@ The **events.k8s.io/v1beta1** API version of Event is no longer served as of v1.
218218
<!--
219219
The **autoscaling/v2beta1** API version of HorizontalPodAutoscaler is no longer served as of v1.25.
220220
221-
222221
* Migrate manifests and API clients to use the **autoscaling/v2** API version, available since v1.23.
223222
* All existing persisted objects are accessible via the new API
224223
-->
225224
从 v1.25 版本开始不再提供 **autoscaling/v2beta1** API 版本的
226225
HorizontalPodAutoscaler。
227226

228227
* 迁移清单和 API 客户端使用 **autoscaling/v2** API 版本,此 API 从 v1.23 版本开始可用;
229-
* 所有的已保存的对象都可以通过新的 API 来访问
228+
* 所有的已保存的对象都可以通过新的 API 来访问
230229

231230
#### PodDisruptionBudget {#poddisruptionbudget-v125}
232231

@@ -244,9 +243,9 @@ The **policy/v1beta1** API version of PodDisruptionBudget is no longer served as
244243
* 所有的已保存的对象都可以通过新的 API 来访问;
245244
* **policy/v1** 中需要额外注意的变更有:
246245
*`policy/v1` 版本的 PodDisruptionBudget 中将 `spec.selector`
247-
设置为空(`{}`)时会选择名字空间中的所有 Pods(在 `policy/v1beta1`
248-
版本中,空的 `spec.selector` 不会选择任何 Pods)。如果 `spec.selector`
249-
未设置,则在两个 API 版本下都不会选择任何 Pods
246+
设置为空(`{}`)时会选择名字空间中的所有 Pod(在 `policy/v1beta1`
247+
版本中,空的 `spec.selector` 不会选择任何 Pod)。如果 `spec.selector`
248+
未设置,则在两个 API 版本下都不会选择任何 Pod
250249

251250
#### PodSecurityPolicy {#psp-v125}
252251

@@ -278,7 +277,7 @@ RuntimeClass in the **node.k8s.io/v1beta1** API version is no longer served as o
278277

279278
* 迁移清单和 API 客户端使用 **node.k8s.io/v1** API 版本,此 API 从 v1.20 版本开始可用;
280279
* 所有的已保存的对象都可以通过新的 API 来访问;
281-
* 没有需要额外注意的变更
280+
* 没有需要额外注意的变更
282281

283282
### v1.22
284283

@@ -303,7 +302,7 @@ The **admissionregistration.k8s.io/v1beta1** API version of MutatingWebhookConfi
303302
* All existing persisted objects are accessible via the new APIs
304303
-->
305304
* 迁移清单和 API 客户端使用 **admissionregistration.k8s.io/v1** API 版本,
306-
此 API 从 v1.16 版本开始可用;
305+
此 API 从 v1.16 版本开始可用;
307306
* 所有的已保存的对象都可以通过新的 API 来访问;
308307

309308
<!--
@@ -388,7 +387,7 @@ The **apiregistration.k8s.io/v1beta1** API version of APIService is no longer se
388387
* 迁移清单和 API 客户端使用 **apiregistration.k8s.io/v1** API 版本,此 API 从
389388
v1.10 版本开始可用;
390389
* 所有的已保存的对象都可以通过新的 API 来访问;
391-
* 没有需要额外注意的变更
390+
* 没有需要额外注意的变更
392391

393392
#### TokenReview {#tokenreview-v122}
394393

@@ -403,7 +402,7 @@ The **authentication.k8s.io/v1beta1** API version of TokenReview is no longer se
403402
* 迁移清单和 API 客户端使用 **authentication.k8s.io/v1** API 版本,此 API 从
404403
v1.6 版本开始可用;
405404
* 所有的已保存的对象都可以通过新的 API 来访问;
406-
* 没有需要额外注意的变更
405+
* 没有需要额外注意的变更
407406

408407
#### SubjectAccessReview resources {#subjectaccessreview-resources-v122}
409408

@@ -424,7 +423,6 @@ SelfSubjectAccessReview、SubjectAccessReview、SelfSubjectRulesReview 不在 v1
424423
* `spec.group` 在 v1 版本中被更名为 `spec.groups`
425424
(补丁 [#32709](https://github.com/kubernetes/kubernetes/issues/32709)
426425

427-
428426
#### CertificateSigningRequest {#certificatesigningrequest-v122}
429427

430428
<!--
@@ -478,7 +476,7 @@ The **coordination.k8s.io/v1beta1** API version of Lease is no longer served as
478476
* 迁移清单和 API 客户端使用 **coordination.k8s.io/v1** API 版本,此 API 从
479477
v1.14 版本开始可用;
480478
* 所有的已保存的对象都可以通过新的 API 来访问;
481-
* 没有需要额外注意的变更
479+
* 没有需要额外注意的变更
482480

483481
#### Ingress {#ingress-v122}
484482

@@ -503,13 +501,13 @@ The **extensions/v1beta1** and **networking.k8s.io/v1beta1** API versions of Ing
503501
* `pathType` is now required for each specified path. Options are `Prefix`, `Exact`, and `ImplementationSpecific`. To match the undefined `v1beta1` behavior, use `ImplementationSpecific`.
504502
-->
505503
* 值得注意的变更:
506-
* `spec.backend` 字段被更名为 `spec.defaultBackend`
507-
* 后端的 `serviceName` 字段被更名为 `service.name`
508-
* 数值表示的后端 `servicePort` 字段被更名为 `service.port.number`
509-
* 字符串表示的后端 `servicePort` 字段被更名为 `service.port.name`
510-
* 对所有要指定的路径,`pathType` 都成为必需字段。
511-
可选项为 `Prefix``Exact``ImplementationSpecific`
512-
要匹配 `v1beta1` 版本中未定义路径类型时的行为,可使用 `ImplementationSpecific`
504+
* `spec.backend` 字段被更名为 `spec.defaultBackend`
505+
* 后端的 `serviceName` 字段被更名为 `service.name`
506+
* 数值表示的后端 `servicePort` 字段被更名为 `service.port.number`
507+
* 字符串表示的后端 `servicePort` 字段被更名为 `service.port.name`
508+
* 对所有要指定的路径,`pathType` 都成为必需字段。
509+
可选项为 `Prefix``Exact``ImplementationSpecific`
510+
要匹配 `v1beta1` 版本中未定义路径类型时的行为,可使用 `ImplementationSpecific`
513511

514512
#### IngressClass {#ingressclass-v122}
515513

@@ -525,8 +523,7 @@ The **networking.k8s.io/v1beta1** API version of IngressClass is no longer serve
525523
* 迁移清单和 API 客户端使用 **networking.k8s.io/v1** API 版本,此 API 从
526524
v1.19 版本开始可用;
527525
* 所有的已保存的对象都可以通过新的 API 来访问;
528-
* 没有需要额外注意的变更
529-
526+
* 没有需要额外注意的变更。
530527

531528
<!--
532529
#### RBAC resources {#rbac-resources-v122}
@@ -545,7 +542,7 @@ Role 和 RoleBinding 不在 v1.22 版本中继续提供。
545542
* 迁移清单和 API 客户端使用 **rbac.authorization.k8s.io/v1** API 版本,此 API 从
546543
v1.8 版本开始可用;
547544
* 所有的已保存的对象都可以通过新的 API 来访问;
548-
* 没有需要额外注意的变更
545+
* 没有需要额外注意的变更
549546

550547
#### PriorityClass {#priorityclass-v122}
551548

@@ -561,7 +558,7 @@ The **scheduling.k8s.io/v1beta1** API version of PriorityClass is no longer serv
561558
* 迁移清单和 API 客户端使用 **scheduling.k8s.io/v1** API 版本,此 API 从
562559
v1.14 版本开始可用;
563560
* 所有的已保存的对象都可以通过新的 API 来访问;
564-
* 没有需要额外注意的变更
561+
* 没有需要额外注意的变更
565562

566563
<!--
567564
#### Storage resources {#storage-resources-v122}
@@ -588,7 +585,7 @@ The **storage.k8s.io/v1beta1** API version of CSIDriver, CSINode, StorageClass,
588585
* StorageClass 从 v1.6 版本开始在 **storage.k8s.io/v1** 中提供;
589586
* VolumeAttachment 从 v1.13 版本开始在 **storage.k8s.io/v1** 中提供;
590587
* 所有的已保存的对象都可以通过新的 API 来访问;
591-
* 没有需要额外注意的变更
588+
* 没有需要额外注意的变更
592589

593590
### v1.16
594591

@@ -609,7 +606,7 @@ The **extensions/v1beta1** API version of NetworkPolicy is no longer served as o
609606

610607
* 迁移清单和 API 客户端使用 **networking.k8s.io/v1** API 版本,此 API 从
611608
v1.8 版本开始可用;
612-
* 所有的已保存的对象都可以通过新的 API 来访问
609+
* 所有的已保存的对象都可以通过新的 API 来访问
613610

614611
#### DaemonSet {#daemonset-v116}
615612

@@ -787,7 +784,7 @@ to automatically convert an existing object:
787784
<!--
788785
For example, to convert an older Deployment to `apps/v1`, you can run:
789786
-->
790-
例如,要将较老的 Deployment 版本转换为 `apps/v1` 版本,你可以运行
787+
例如,要将较老的 Deployment 版本转换为 `apps/v1` 版本,你可以运行
791788

792789
`kubectl-convert -f ./my-deployment.yaml --output-version apps/v1`
793790

0 commit comments

Comments
 (0)