From 3f830c2a5a9c33ff0329af8416df290f9f0d646b Mon Sep 17 00:00:00 2001 From: Dominic Yin Date: Thu, 16 Apr 2020 17:21:32 +0800 Subject: [PATCH] Update content/zh/docs/concepts/containers/runtime-class.md --- .../docs/concepts/containers/runtime-class.md | 141 ++++++------------ 1 file changed, 49 insertions(+), 92 deletions(-) diff --git a/content/zh/docs/concepts/containers/runtime-class.md b/content/zh/docs/concepts/containers/runtime-class.md index 53bb567960..6229009612 100644 --- a/content/zh/docs/concepts/containers/runtime-class.md +++ b/content/zh/docs/concepts/containers/runtime-class.md @@ -16,30 +16,21 @@ This page describes the RuntimeClass resource and runtime selection mechanism. --> 本页面描述了 RuntimeClass 资源和运行时的选择机制。 -{{< warning >}} RuntimeClass 特性在 v1.14 版本升级为 beta 特性时引入了不兼容的改变。 -如果你在 v1.14 以前的版本中使用 RuntimeClass,请查阅 -[Upgrading RuntimeClass from Alpha to Beta](#upgrading-runtimeclass-from-alpha-to-beta)。 -{{< /warning >}} +RuntimeClass is a feature for selecting the container runtime configuration. The container runtime +configuration is used to run a Pod's containers. +--> +RuntimeClass 是一个用于选择容器运行时配置的特性,容器运行时配置用于运行 Pod 中的容器。 {{% /capture %}} {{% capture body %}} -## Runtime Class - - -RuntimeClass 是用于选择容器运行时配置的特性,容器运行时配置用于运行 Pod 中的容器。 - + +## 动机 -### 设置 +## 设置 -#### 1. 在节点上配置 CRI 实现 +### 1. 在节点上配置 CRI 实现 RuntimeClass 假设集群中的节点配置是同构的 -(换言之,所有的节点在容器运行时方面的配置是相同的)。 -如果需要支持异构节点,配置方法请参阅下面的 [Scheduling](#scheduling)。 +heterogenous node configurations, see [Scheduling](#scheduling) below.--> +RuntimeClass 假设集群中的节点配置是同构的(换言之,所有的节点在容器运行时方面的配置是相同的)。 +如果需要支持异构节点,配置方法请参阅下面的 [调度](#scheduling)。 {{< /note >}} -#### 2. 创建相应的 RuntimeClass 资源 +### 2. 创建相应的 RuntimeClass 资源 -### 使用说明 +## 使用说明 如果未指定 `runtimeClassName` ,则将使用默认的 RuntimeHandler,相当于禁用 RuntimeClass 功能特性。 + +### CRI 配置 -关于如何安装 CRI 运行时,请查阅[CRI installation](/docs/setup/production-environment/container-runtimes/)。 +关于如何安装 CRI 运行时,请查阅 [CRI 安装](/docs/setup/production-environment/container-runtimes/)。 #### dockershim @@ -229,7 +223,7 @@ handlers are configured under the [crio.runtime table](https://github.com/kubernetes-sigs/cri-o/blob/master/docs/crio.conf.5.md#crioruntime-table): --> 通过 cri-o 的 `/etc/crio/crio.conf` 配置文件来配置运行时 handler。 -handler 需要配置在[crio.runtime 表](https://github.com/kubernetes-sigs/cri-o/blob/master/docs/crio.conf.5.md#crioruntime-table) +handler 需要配置在 [crio.runtime 表](https://github.com/kubernetes-sigs/cri-o/blob/master/docs/crio.conf.5.md#crioruntime-table) 下方: ``` @@ -244,7 +238,10 @@ https://github.com/kubernetes-sigs/cri-o/blob/master/cmd/crio/config.go 更详细信息,请查阅 containerd 配置文档: https://github.com/kubernetes-sigs/cri-o/blob/master/cmd/crio/config.go -### Scheduling + +## 调度 {{< feature-state for_k8s_version="v1.16" state="beta" >}} @@ -252,11 +249,11 @@ https://github.com/kubernetes-sigs/cri-o/blob/master/cmd/crio/config.go As of Kubernetes v1.16, RuntimeClass includes support for heterogenous clusters through its `scheduling` fields. Through the use of these fields, you can ensure that pods running with this RuntimeClass are scheduled to nodes that support it. To use the scheduling support, you must have -the RuntimeClass [admission controller][] enabled (the default, as of 1.16). +the [RuntimeClass admission controller][] enabled (the default, as of 1.16). --> 在 Kubernetes v1.16 版本里,RuntimeClass 特性引入了 `scheduling` 字段来支持异构集群。 通过该字段,可以确保 pod 被调度到支持指定运行时的节点上。 -该调度支持,需要确保 RuntimeClass [admission controller][] 处于开启状态(1.16 版本默认开启)。 +该调度支持,需要确保 [RuntimeClass admission controller][] 处于开启状态(1.16 版本默认开启)。 +### Pod 开销 -{{< feature-state for_k8s_version="v1.16" state="alpha" >}} +{{< feature-state for_k8s_version="v1.18" state="beta" >}} -在 Kubernetes v1.16 版本中,RuntimeClass 开始支持 pod 的 overhead,作为 [`PodOverhead`](/docs/concepts/configuration/pod-overhead) -特性的一部分。 -若要使用 `PodOverhead` 特性,你需要确保 PodOverhead 特性开关处于开启状态(默认为关闭状态)。 +你可以指定与运行 Pod 相关的 _开销_ 资源。声明开销即允许集群(包括调度器)在决策 Pod 和资源时将其考虑在内。 +若要使用 Pod 开销特性,你必须确保 PodOverhead [特性开关](/docs/reference/command-line-tools-reference/feature-gates/) 处于开启状态(默认为启用状态)。 -Pod 的 overhead 在 RuntimeClass 的 `Overhead` 字段定义,该字段用于指定使用 RuntimeClass 特性时带来的 overhead。 +Pod 开销通过 RuntimeClass 的 `overhead` 字段定义。通过使用这些字段,你可以指定使用该 RuntimeClass 运行 Pod 时的开销并确保 Kubernetes 将这些开销计算在内。 -### Upgrading RuntimeClass from Alpha to Beta +{{% /capture %}} +{{% capture whatsnext %}} -RuntimeClass Beta 特性包含如下几个改变: - - -- `node.k8s.io` API 组和 `runtimeclasses.node.k8s.io` 资源已从 CRD 中迁移到内置的 API 中; -- `spec` 被放置到 RuntimeClass 中(例如,没有 RuntimeClassSpec 了); -- `runtimeHandler` 字段重命名为 `handler`; -- `handler` 字段需要在所有版本的 API 提供,这意味着 `runtimeHandler` 字段在 Alpha API 中也需要提供; -- `handler` 字段必须是一个合法的 DNS 标识([RFC 1123](https://tools.ietf.org/html/rfc1123)), - 这意味着不可以包含 `.` 字符。合法的 handler 必须满足如下规则:`^[a-z0-9]([-a-z0-9]*[a-z0-9])?$`。 - - -**Action Required:** RuntimeClass 特性从 alpha 版本升级到 beta 版本,需要做如下动作: - - -- RuntimeClass 资源必须在升级到 v1.14 *之后* 再创建,并且 CRD 资源 `runtimeclasses.node.k8s.io` 必须要手动删除: - ``` - kubectl delete customresourcedefinitions.apiextensions.k8s.io runtimeclasses.node.k8s.io - ``` -- RuntimeClasses 中未指定或为空的 `runtimeHandler` 和 使用包含 `.` 符号的 handler 将不再合法, - 必须迁移成合法的 handler 配置(见上)。 - -### Further Reading - - [RuntimeClass Design](https://github.com/kubernetes/enhancements/blob/master/keps/sig-node/runtime-class.md) - [RuntimeClass Scheduling Design](https://github.com/kubernetes/enhancements/blob/master/keps/sig-node/runtime-class-scheduling.md) - Read about the [Pod Overhead](/docs/concepts/configuration/pod-overhead/) concept - [PodOverhead Feature Design](https://github.com/kubernetes/enhancements/blob/master/keps/sig-node/20190226-pod-overhead.md) +--> +- [RuntimeClass 设计](https://github.com/kubernetes/enhancements/blob/master/keps/sig-node/runtime-class.md) +- [RuntimeClass 调度设计](https://github.com/kubernetes/enhancements/blob/master/keps/sig-node/runtime-class-scheduling.md) +- 阅读关于 [Pod 开销](/docs/concepts/configuration/pod-overhead/) 的概念 +- [PodOverhead 特性设计](https://github.com/kubernetes/enhancements/blob/master/keps/sig-node/20190226-pod-overhead.md) {{% /capture %}}