Skip to content

Commit 5015aa2

Browse files
authored
Merge pull request #27783 from tengqm/zh-sync-concepts-11
[zh] Resync concepts section (11)
2 parents 8293a8e + 7703a4a commit 5015aa2

File tree

5 files changed

+108
-23
lines changed

5 files changed

+108
-23
lines changed

content/zh/docs/concepts/extend-kubernetes/_index.md

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
title: 扩展 Kubernetes
33
weight: 110
44
description: 改变你的 Kubernetes 集群的行为的若干方法。
5+
feature:
6+
title: 为扩展性设计
7+
description: >
8+
无需更改上游源码即可扩展你的 Kubernetes 集群。
59
content_type: concept
610
no_list: true
711
---
@@ -14,6 +18,10 @@ reviewers:
1418
- lavalamp
1519
- cheftako
1620
- chenopis
21+
feature:
22+
title: Designed for extensibility
23+
description: >
24+
Add features to your Kubernetes cluster without changing upstream source code.
1725
content_type: concept
1826
no_list: true
1927
-->
@@ -176,9 +184,11 @@ Kubernetes control plane.
176184

177185
下面的示意图中展示了这些扩展点如何与 Kubernetes 控制面交互。
178186

179-
<img src="https://docs.google.com/drawings/d/e/2PACX-1vQBRWyXLVUlQPlp7BvxvV9S1mxyXSM6rAc_cbLANvKlu6kCCf-kGTporTMIeG5GZtUdxXz1xowN7RmL/pub?w=960&h=720">
180-
181187
<!-- image source drawing https://docs.google.com/drawings/d/1muJ7Oxuj_7Gtv7HV9-2zJbOnkQJnjxq-v1ym_kZfB-4/edit?ts=5a01e054 -->
188+
<!--
189+
![Extension Points and the Control Plane](/docs/concepts/extend-kubernetes/control-plane.png)
190+
-->
191+
![扩展点与控制面](/docs/concepts/extend-kubernetes/control-plane.png)
182192

183193
<!--
184194
## Extension Points
@@ -189,9 +199,11 @@ This diagram shows the extension points in a Kubernetes system.
189199

190200
此示意图显示的是 Kubernetes 系统中的扩展点。
191201

192-
<img src="https://docs.google.com/drawings/d/e/2PACX-1vSH5ZWUO2jH9f34YHenhnCd14baEb4vT-pzfxeFC7NzdNqRDgdz4DDAVqArtH4onOGqh0bhwMX0zGBb/pub?w=425&h=809">
193-
194202
<!-- image source diagrams: https://docs.google.com/drawings/d/1k2YdJgNTtNfW7_A8moIIkij-DmVgEhNrn3y2OODwqQQ/view -->
203+
<!--
204+
![Extension Points](/docs/concepts/extend-kubernetes/extension-points.png)
205+
-->
206+
![扩展点](/docs/concepts/extend-kubernetes/extension-points.png)
195207

196208
<!--
197209
1. Users often interact with the Kubernetes API using `kubectl`. [Kubectl plugins](/docs/tasks/extend-kubectl/kubectl-plugins/) extend the kubectl binary. They only affect the individual user's local environment, and so cannot enforce site-wide policies.
@@ -236,12 +248,15 @@ If you are unsure where to start, this flowchart can help. Note that some soluti
236248
如果你无法确定从何处入手,下面的流程图可能对你有些帮助。
237249
注意,某些方案可能需要同时采用几种类型的扩展。
238250

239-
<img src="https://docs.google.com/drawings/d/e/2PACX-1vRWXNNIVWFDqzDY0CsKZJY3AR8sDeFDXItdc5awYxVH8s0OLherMlEPVUpxPIB1CSUu7GPk7B2fEnzM/pub?w=1440&h=1080">
240-
241251
<!-- image source drawing: https://docs.google.com/drawings/d/1sdviU6lDz4BpnzJNHfNpQrqI9F19QZ07KnhnxVrp2yg/edit -->
252+
<!--
253+
![Flowchart for Extension](/docs/concepts/extend-kubernetes/flowchart.png)
254+
-->
255+
![扩展流程图](/docs/concepts/extend-kubernetes/flowchart.png)
242256

243257
<!--
244258
## API Extensions
259+
245260
### User-Defined Types
246261
247262
Consider adding a Custom Resource to Kubernetes if you want to define new controllers, application configuration objects or other declarative APIs, and to manage them using Kubernetes tools, such as `kubectl`.
@@ -329,7 +344,7 @@ Kubernetes 提供若干种内置的认证方法,以及
329344
<!--
330345
### Authorization
331346
332-
[Authorization](/docs/reference/access-authn-authz/webhook/) determines whether specific users can read, write, and do other operations on API resources. It just works at the level of whole resources - it doesn't discriminate based on arbitrary object fields. If the built-in authorization options don't meet your needs, and [Authorization webhook](/docs/reference/access-authn-authz/webhook/) allows calling out to user-provided code to make an authorization decision.
347+
[Authorization](/docs/reference/access-authn-authz/webhook/) determines whether specific users can read, write, and do other operations on API resources. It works at the level of whole resources - it doesn't discriminate based on arbitrary object fields. If the built-in authorization options don't meet your needs, and [Authorization webhook](/docs/reference/access-authn-authz/webhook/) allows calling out to user-provided code to make an authorization decision.
333348
-->
334349
### 鉴权 {#authorization}
335350

content/zh/docs/concepts/extend-kubernetes/api-extension/apiserver-aggregation.md

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,19 +64,14 @@ apiserver-builder 库同时提供构造扩展 API 服务器和控制器框架代
6464
Extension API servers should have low latency networking to and from the kube-apiserver.
6565
Discovery requests are required to round-trip from the kube-apiserver in five seconds or less.
6666
67-
If your extension API server cannot achieve that latency requirement, consider making changes that let you meet it. You can also set the
68-
`EnableAggregatedDiscoveryTimeout=false` [feature gate](/docs/reference/command-line-tools-reference/feature-gates/) on the kube-apiserver
69-
to disable the timeout restriction. This deprecated feature gate will be removed in a future release.
67+
If your extension API server cannot achieve that latency requirement, consider making changes that let you meet it.
7068
-->
7169
### 反应延迟 {#response-latency}
7270

7371
扩展 API 服务器与 kube-apiserver 之间需要存在低延迟的网络连接。
7472
发现请求需要在五秒钟或更短的时间内完成到 kube-apiserver 的往返。
7573

7674
如果你的扩展 API 服务器无法满足这一延迟要求,应考虑如何更改配置已满足需要。
77-
你也可以为 kube-apiserver 设置 `EnableAggregatedDiscoveryTimeout=false`
78-
[特性门控](/zh/docs/reference/command-line-tools-reference/feature-gates/)
79-
来禁用超时限制。此特性门控已经废弃,将在未来版本中被删除。
8075

8176
## {{% heading "whatsnext" %}}
8277

content/zh/docs/concepts/extend-kubernetes/api-extension/custom-resources.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ Kubernetes 安装中就可用。定制资源所代表的是对特定 Kubernetes
6767
<!--
6868
## Custom controllers
6969
70-
On their own, custom resources simply let you store and retrieve structured data.
70+
On their own, custom resources let you store and retrieve structured data.
7171
When you combine a custom resource with a *custom controller*, custom resources
7272
provide a true _declarative API_.
7373
-->
@@ -93,13 +93,13 @@ desired state, and continually maintains this state.
9393
You can deploy and update a custom controller on a running cluster, independently
9494
of the cluster's lifecycle. Custom controllers can work with any kind of resource,
9595
but they are especially effective when combined with custom resources. The
96-
[Operator pattern](https://coreos.com/blog/introducing-operators.html) combines custom
96+
[Operator pattern](/docs/concepts/extend-kubernetes/operator/) combines custom
9797
resources and custom controllers. You can use custom controllers to encode domain knowledge
9898
for specific applications into an extension of the Kubernetes API.
9999
-->
100100
你可以在一个运行中的集群上部署和更新定制控制器,这类操作与集群的生命周期无关。
101101
定制控制器可以用于任何类别的资源,不过它们与定制资源结合起来时最为有效。
102-
[Operator 模式](https://coreos.com/blog/introducing-operators.html)就是将定制资源
102+
[Operator 模式](/zh/docs/concepts/extend-kubernetes/operator/)就是将定制资源
103103
与定制控制器相结合的。你可以使用定制控制器来将特定于某应用的领域知识组织
104104
起来,以编码的形式构造对 Kubernetes API 的扩展。
105105

@@ -257,7 +257,7 @@ Kubernetes 提供了两种方式供你向集群中添加定制资源:
257257
<!--
258258
Kubernetes provides these two options to meet the needs of different users, so that neither ease of use nor flexibility is compromised.
259259
260-
Aggregated APIs are subordinate API servers that sit behind the primary API server, which acts as a proxy. This arrangement is called [API Aggregation](/docs/concepts/extend-kubernetes/api-extension/apiserver-aggregation/) (AA). To users, it simply appears that the Kubernetes API is extended.
260+
Aggregated APIs are subordinate API servers that sit behind the primary API server, which acts as a proxy. This arrangement is called [API Aggregation](/docs/concepts/extend-kubernetes/api-extension/apiserver-aggregation/) (AA). To users, the Kubernetes API is extended.
261261
262262
CRDs allow users to create new types of resources without adding another API server. You do not need to understand API Aggregation to use CRDs.
263263

content/zh/docs/concepts/extend-kubernetes/compute-storage-net/device-plugins.md

Lines changed: 80 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -323,13 +323,87 @@ for these devices:
323323
kubelet 提供了 gRPC 服务来使得正在使用中的设备被发现,并且还未这些设备提供了元数据:
324324

325325
```gRPC
326-
// PodResourcesLister is a service provided by the kubelet that provides information about the
327-
// node resources consumed by pods and containers on the node
326+
// PodResourcesLister 是一个由 kubelet 提供的服务,用来提供供节点上
327+
// Pods 和容器使用的节点资源的信息
328328
service PodResourcesLister {
329329
rpc List(ListPodResourcesRequest) returns (ListPodResourcesResponse) {}
330+
rpc GetAllocatableResources(AllocatableResourcesRequest) returns (AllocatableResourcesResponse) {}
330331
}
331332
```
332333

334+
<!--
335+
The `List` endpoint provides information on resources of running pods, with details such as the
336+
id of exclusively allocated CPUs, device id as it was reported by device plugins and id of
337+
the NUMA node where these devices are allocated.
338+
-->
339+
这一 `List` 端点提供运行中 Pods 的资源信息,包括类似独占式分配的
340+
CPU ID、设备插件所报告的设备 ID 以及这些设备分配所处的 NUMA 节点 ID。
341+
342+
```gRPC
343+
// ListPodResourcesResponse 是 List 函数的响应
344+
message ListPodResourcesResponse {
345+
repeated PodResources pod_resources = 1;
346+
}
347+
348+
// PodResources 包含关于分配给 Pod 的节点资源的信息
349+
message PodResources {
350+
string name = 1;
351+
string namespace = 2;
352+
repeated ContainerResources containers = 3;
353+
}
354+
355+
// ContainerResources 包含分配给容器的资源的信息
356+
message ContainerResources {
357+
string name = 1;
358+
repeated ContainerDevices devices = 2;
359+
repeated int64 cpu_ids = 3;
360+
}
361+
362+
// Topology 描述资源的硬件拓扑结构
363+
message TopologyInfo {
364+
repeated NUMANode nodes = 1;
365+
}
366+
367+
// NUMA 代表的是 NUMA 节点
368+
message NUMANode {
369+
int64 ID = 1;
370+
}
371+
372+
// ContainerDevices 包含分配给容器的设备信息
373+
message ContainerDevices {
374+
string resource_name = 1;
375+
repeated string device_ids = 2;
376+
TopologyInfo topology = 3;
377+
}
378+
```
379+
380+
<!--
381+
GetAllocatableResources provides information on resources initially available on the worker node.
382+
It provides more information than kubelet exports to APIServer.
383+
-->
384+
端点 `GetAllocatableResources` 提供最初在工作节点上可用的资源的信息。
385+
此端点所提供的信息比导出给 API 服务器的信息更丰富。
386+
387+
388+
```gRPC
389+
// AllocatableResourcesResponses 包含 kubelet 所了解到的所有设备的信息
390+
message AllocatableResourcesResponse {
391+
repeated ContainerDevices devices = 1;
392+
repeated int64 cpu_ids = 2;
393+
}
394+
395+
```
396+
397+
<!--
398+
`ContainerDevices` do expose the topology information declaring to which NUMA cells the device is affine.
399+
The NUMA cells are identified using a opaque integer ID, which value is consistent to what device
400+
plugins report [when they register themselves to the kubelet](https://kubernetes.io/docs/concepts/extend-kubernetes/compute-storage-net/device-plugins/#device-plugin-integration-with-the-topology-manager).
401+
-->
402+
`ContainerDevices` 会向外提供各个设备所隶属的 NUMA 单元这类拓扑信息。
403+
NUMA 单元通过一个整数 ID 来标识,其取值与设备插件所报告的一致。
404+
[设备插件注册到 kubelet 时](/zh/docs/concepts/extend-kubernetes/compute-storage-net/device-plugins/)
405+
会报告这类信息。
406+
333407
<!--
334408
The gRPC service is served over a unix socket at `/var/lib/kubelet/pod-resources/kubelet.sock`.
335409
Monitoring agents for device plugin resources can be deployed as a daemon, or as a DaemonSet.
@@ -338,7 +412,8 @@ agents must run in a privileged security context. If a device monitoring agent
338412
DaemonSet, `/var/lib/kubelet/pod-resources` must be mounted as a
339413
{{< glossary_tooltip term_id="volume" >}} in the device monitoring agent's
340414
[PodSpec](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#podspec-v1-core).
341-
Support for the "PodResources service" requires `KubeletPodResources` [feature gate](/docs/reference/command-line-tools-reference/feature-gates/) to be enabled.
415+
416+
Support for the "PodResourcesLister service" requires `KubeletPodResources` [feature gate](/docs/reference/command-line-tools-reference/feature-gates/) to be enabled.
342417
It is enabled by default starting with Kubernetes 1.15 and is v1 since Kubernetes 1.20.
343418
-->
344419
gRPC 服务通过 `/var/lib/kubelet/pod-resources/kubelet.sock` 的 UNIX 套接字来提供服务。
@@ -350,9 +425,9 @@ gRPC 服务通过 `/var/lib/kubelet/pod-resources/kubelet.sock` 的 UNIX 套接
350425
中声明将 `/var/lib/kubelet/pod-resources` 目录以
351426
{{< glossary_tooltip text="卷" term_id="volume" >}}的形式被挂载到设备监控代理中。
352427

353-
对“PodResources 服务”的支持要求启用 `KubeletPodResources`
428+
对“PodResourcesLister 服务”的支持要求启用 `KubeletPodResources`
354429
[特性门控](/zh/docs/reference/command-line-tools-reference/feature-gates/)
355-
从 Kubernetes 1.15 开始默认启用,自从 Kubernetes 1.20开始为 v1。
430+
从 Kubernetes 1.15 开始默认启用,自从 Kubernetes 1.20 开始为 v1。
356431

357432
<!--
358433
## Device Plugin integration with the Topology Manager

content/zh/docs/concepts/extend-kubernetes/compute-storage-net/network-plugins.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Kubernetes中的网络插件有几种类型:
3636
The kubelet has a single default network plugin, and a default network common to the entire cluster. It probes for plugins when it starts up, remembers what it finds, and executes the selected plugin at appropriate times in the pod lifecycle (this is only true for Docker, as CRI manages its own CNI plugins). There are two Kubelet command line parameters to keep in mind when using plugins:
3737
3838
* `cni-bin-dir`: Kubelet probes this directory for plugins on startup
39-
* `network-plugin`: The network plugin to use from `cni-bin-dir`. It must match the name reported by a plugin probed from the plugin directory. For CNI plugins, this is simply "cni".
39+
* `network-plugin`: The network plugin to use from `cni-bin-dir`. It must match the name reported by a plugin probed from the plugin directory. For CNI plugins, this is "cni".
4040
-->
4141
## 安装
4242

0 commit comments

Comments
 (0)