From 7703a4a738d12e8d9a0319b6e46ffb24f65abc3c Mon Sep 17 00:00:00 2001 From: Qiming Teng Date: Wed, 28 Apr 2021 17:42:43 +0800 Subject: [PATCH] [zh] Resync concepts section (11) --- .../docs/concepts/extend-kubernetes/_index.md | 29 +++++-- .../api-extension/apiserver-aggregation.md | 7 +- .../api-extension/custom-resources.md | 8 +- .../compute-storage-net/device-plugins.md | 85 +++++++++++++++++-- .../compute-storage-net/network-plugins.md | 2 +- 5 files changed, 108 insertions(+), 23 deletions(-) diff --git a/content/zh/docs/concepts/extend-kubernetes/_index.md b/content/zh/docs/concepts/extend-kubernetes/_index.md index 2d48a28e24..22d9c7dac2 100644 --- a/content/zh/docs/concepts/extend-kubernetes/_index.md +++ b/content/zh/docs/concepts/extend-kubernetes/_index.md @@ -2,6 +2,10 @@ title: 扩展 Kubernetes weight: 110 description: 改变你的 Kubernetes 集群的行为的若干方法。 +feature: + title: 为扩展性设计 + description: > + 无需更改上游源码即可扩展你的 Kubernetes 集群。 content_type: concept no_list: true --- @@ -14,6 +18,10 @@ reviewers: - lavalamp - cheftako - chenopis +feature: + title: Designed for extensibility + description: > + Add features to your Kubernetes cluster without changing upstream source code. content_type: concept no_list: true --> @@ -176,9 +184,11 @@ Kubernetes control plane. 下面的示意图中展示了这些扩展点如何与 Kubernetes 控制面交互。 - - + +![扩展点与控制面](/docs/concepts/extend-kubernetes/control-plane.png) + +![扩展点](/docs/concepts/extend-kubernetes/extension-points.png) + +![扩展流程图](/docs/concepts/extend-kubernetes/flowchart.png) ### 鉴权 {#authorization} diff --git a/content/zh/docs/concepts/extend-kubernetes/api-extension/apiserver-aggregation.md b/content/zh/docs/concepts/extend-kubernetes/api-extension/apiserver-aggregation.md index e08fa7690d..f11620acf2 100644 --- a/content/zh/docs/concepts/extend-kubernetes/api-extension/apiserver-aggregation.md +++ b/content/zh/docs/concepts/extend-kubernetes/api-extension/apiserver-aggregation.md @@ -64,9 +64,7 @@ apiserver-builder 库同时提供构造扩展 API 服务器和控制器框架代 Extension API servers should have low latency networking to and from the kube-apiserver. Discovery requests are required to round-trip from the kube-apiserver in five seconds or less. -If your extension API server cannot achieve that latency requirement, consider making changes that let you meet it. You can also set the -`EnableAggregatedDiscoveryTimeout=false` [feature gate](/docs/reference/command-line-tools-reference/feature-gates/) on the kube-apiserver -to disable the timeout restriction. This deprecated feature gate will be removed in a future release. +If your extension API server cannot achieve that latency requirement, consider making changes that let you meet it. --> ### 反应延迟 {#response-latency} @@ -74,9 +72,6 @@ to disable the timeout restriction. This deprecated feature gate will be removed 发现请求需要在五秒钟或更短的时间内完成到 kube-apiserver 的往返。 如果你的扩展 API 服务器无法满足这一延迟要求,应考虑如何更改配置已满足需要。 -你也可以为 kube-apiserver 设置 `EnableAggregatedDiscoveryTimeout=false` -[特性门控](/zh/docs/reference/command-line-tools-reference/feature-gates/) -来禁用超时限制。此特性门控已经废弃,将在未来版本中被删除。 ## {{% heading "whatsnext" %}} diff --git a/content/zh/docs/concepts/extend-kubernetes/api-extension/custom-resources.md b/content/zh/docs/concepts/extend-kubernetes/api-extension/custom-resources.md index a893ef8765..5094d8910b 100644 --- a/content/zh/docs/concepts/extend-kubernetes/api-extension/custom-resources.md +++ b/content/zh/docs/concepts/extend-kubernetes/api-extension/custom-resources.md @@ -67,7 +67,7 @@ Kubernetes 安装中就可用。定制资源所代表的是对特定 Kubernetes @@ -93,13 +93,13 @@ desired state, and continually maintains this state. You can deploy and update a custom controller on a running cluster, independently of the cluster's lifecycle. Custom controllers can work with any kind of resource, but they are especially effective when combined with custom resources. The -[Operator pattern](https://coreos.com/blog/introducing-operators.html) combines custom +[Operator pattern](/docs/concepts/extend-kubernetes/operator/) combines custom resources and custom controllers. You can use custom controllers to encode domain knowledge for specific applications into an extension of the Kubernetes API. --> 你可以在一个运行中的集群上部署和更新定制控制器,这类操作与集群的生命周期无关。 定制控制器可以用于任何类别的资源,不过它们与定制资源结合起来时最为有效。 -[Operator 模式](https://coreos.com/blog/introducing-operators.html)就是将定制资源 +[Operator 模式](/zh/docs/concepts/extend-kubernetes/operator/)就是将定制资源 与定制控制器相结合的。你可以使用定制控制器来将特定于某应用的领域知识组织 起来,以编码的形式构造对 Kubernetes API 的扩展。 @@ -257,7 +257,7 @@ Kubernetes 提供了两种方式供你向集群中添加定制资源: +这一 `List` 端点提供运行中 Pods 的资源信息,包括类似独占式分配的 +CPU ID、设备插件所报告的设备 ID 以及这些设备分配所处的 NUMA 节点 ID。 + +```gRPC +// ListPodResourcesResponse 是 List 函数的响应 +message ListPodResourcesResponse { + repeated PodResources pod_resources = 1; +} + +// PodResources 包含关于分配给 Pod 的节点资源的信息 +message PodResources { + string name = 1; + string namespace = 2; + repeated ContainerResources containers = 3; +} + +// ContainerResources 包含分配给容器的资源的信息 +message ContainerResources { + string name = 1; + repeated ContainerDevices devices = 2; + repeated int64 cpu_ids = 3; +} + +// Topology 描述资源的硬件拓扑结构 +message TopologyInfo { + repeated NUMANode nodes = 1; +} + +// NUMA 代表的是 NUMA 节点 +message NUMANode { + int64 ID = 1; +} + +// ContainerDevices 包含分配给容器的设备信息 +message ContainerDevices { + string resource_name = 1; + repeated string device_ids = 2; + TopologyInfo topology = 3; +} +``` + + +端点 `GetAllocatableResources` 提供最初在工作节点上可用的资源的信息。 +此端点所提供的信息比导出给 API 服务器的信息更丰富。 + + +```gRPC +// AllocatableResourcesResponses 包含 kubelet 所了解到的所有设备的信息 +message AllocatableResourcesResponse { + repeated ContainerDevices devices = 1; + repeated int64 cpu_ids = 2; +} + +``` + + +`ContainerDevices` 会向外提供各个设备所隶属的 NUMA 单元这类拓扑信息。 +NUMA 单元通过一个整数 ID 来标识,其取值与设备插件所报告的一致。 +[设备插件注册到 kubelet 时](/zh/docs/concepts/extend-kubernetes/compute-storage-net/device-plugins/) +会报告这类信息。 + gRPC 服务通过 `/var/lib/kubelet/pod-resources/kubelet.sock` 的 UNIX 套接字来提供服务。 @@ -350,9 +425,9 @@ gRPC 服务通过 `/var/lib/kubelet/pod-resources/kubelet.sock` 的 UNIX 套接 中声明将 `/var/lib/kubelet/pod-resources` 目录以 {{< glossary_tooltip text="卷" term_id="volume" >}}的形式被挂载到设备监控代理中。 -对“PodResources 服务”的支持要求启用 `KubeletPodResources` +对“PodResourcesLister 服务”的支持要求启用 `KubeletPodResources` [特性门控](/zh/docs/reference/command-line-tools-reference/feature-gates/)。 -从 Kubernetes 1.15 开始默认启用,自从 Kubernetes 1.20开始为 v1。 +从 Kubernetes 1.15 开始默认启用,自从 Kubernetes 1.20 开始为 v1。 ## 安装