[zh] Resync architecture Node page
The English version was reworked ...
This commit is contained in:
@@ -15,16 +15,206 @@ weight: 10
|
||||
<!-- overview -->
|
||||
|
||||
<!--
|
||||
A node is a worker machine in Kubernetes, previously known as a `minion`. A node
|
||||
may be a VM or physical machine, depending on the cluster. Each node contains
|
||||
the services necessary to run [pods](/docs/concepts/workloads/pods/pod/) and is managed by the master
|
||||
components. The services on a node include the [container runtime](/docs/concepts/overview/components/#node-components), kubelet and kube-proxy. See
|
||||
[The Kubernetes Node](https://git.k8s.io/community/contributors/design-proposals/architecture/architecture.md#the-kubernetes-node) section in the
|
||||
architecture design doc for more details.
|
||||
Kubernetes runs your workload by placing containers into Pods to run on _Nodes_.
|
||||
A node may be a virtual or physical machine, depending on the cluster. Each node
|
||||
contains the services necessary to run
|
||||
{{< glossary_tooltip text="Pods" term_id="pod" >}}, managed by the
|
||||
{{< glossary_tooltip text="control plane" term_id="control-plane" >}}.
|
||||
|
||||
Typically you have several nodes in a cluster; in a learning or resource-limited
|
||||
environment, you might have just one.
|
||||
|
||||
The [components](/docs/concepts/overview/components/#node-components) on a node include the
|
||||
{{< glossary_tooltip text="kubelet" term_id="kubelet" >}}, a
|
||||
{{< glossary_tooltip text="container runtime" term_id="container-runtime" >}}, and the
|
||||
{{< glossary_tooltip text="kube-proxy" term_id="kube-proxy" >}}.
|
||||
-->
|
||||
在 Kubernetes 中,节点(Node)是执行工作的机器,以前叫做 `minion`。根据你的集群环境,节点可以是一个虚拟机或者物理机器。每个节点都包含用于运行 [pods](/docs/concepts/workloads/pods/pod/) 的必要服务,并由主控组件管理。节点上的服务包括 [容器运行时](/docs/concepts/overview/components/#node-components)、kubelet 和 kube-proxy。查阅架构设计文档中 [Kubernetes 节点](https://git.k8s.io/community/contributors/design-proposals/architecture/architecture.md#the-kubernetes-node) 一节获取更多细节。
|
||||
Kubernetes 通过将容器放入在节点(Node)上运行的 Pod 中来执行你的工作负载。
|
||||
节点可以是一个虚拟机或者物理机器,取决于所在的集群配置。每个节点都包含用于运行
|
||||
{{< glossary_tooltip text="Pod" term_id="pod" >}} 所需要的服务,这些服务由
|
||||
{{< glossary_tooltip text="控制面" term_id="control-plane" >}}负责管理。
|
||||
|
||||
通常集群中会有若干个节点;而在一个学习用或者资源受限的环境中,你的集群中也可能
|
||||
只有一个节点。
|
||||
|
||||
节点上的[组件](/zh/docs/concepts/overview/components/#node-components)包括
|
||||
{{< glossary_tooltip text="kubelet" term_id="kubelet" >}}、
|
||||
{{< glossary_tooltip text="容器运行时" term_id="container-runtime" >}}以及
|
||||
{{< glossary_tooltip text="kube-proxy" term_id="kube-proxy" >}}。
|
||||
|
||||
<!-- body -->
|
||||
<!--
|
||||
## Management
|
||||
|
||||
There are two main ways to have Nodes added to the {{< glossary_tooltip text="API server" term_id="kube-apiserver" >}}:
|
||||
|
||||
1. The kubelet on a node self-registers to the control plane
|
||||
2. You, or another human user, manually add a Node object
|
||||
|
||||
After you create a Node object, or the kubelet on a node self-registers, the
|
||||
control plane checks whether the new Node object is valid. For example, if you
|
||||
try to create a Node from the following JSON manifest:
|
||||
-->
|
||||
## 管理 {#management}
|
||||
|
||||
向 {{< glossary_tooltip text="API 服务器" term_id="kube-apiserver"
|
||||
>}}添加节点的方式主要有两种:
|
||||
|
||||
1. 节点上的 `kubelet` 向控制面执行自注册;
|
||||
2. 你,或者别的什么人,手动添加一个 Node 对象。
|
||||
|
||||
在你创建了 Node 对象或者节点上的 `kubelet` 执行了自注册操作之后,
|
||||
控制面会检查新的 Node 对象是否合法。例如,如果你使用下面的 JSON
|
||||
对象来创建 Node 对象:
|
||||
|
||||
```json
|
||||
{
|
||||
"kind": "Node",
|
||||
"apiVersion": "v1",
|
||||
"metadata": {
|
||||
"name": "10.240.79.157",
|
||||
"labels": {
|
||||
"name": "my-first-k8s-node"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
<!--
|
||||
Kubernetes creates a Node object internally (the representation). Kubernetes checks
|
||||
that a kubelet has registered to the API server that matches the `metadata.name`
|
||||
field of the Node. If the node is healthy (if all necessary services are running),
|
||||
it is eligible to run a Pod. Otherwise, that node is ignored for any cluster activity
|
||||
until it becomes healthy.
|
||||
-->
|
||||
Kubernetes 会在内部创建一个 Node 对象作为节点的表示。Kubernetes 检查 `kubelet`
|
||||
向 API 服务器注册节点时使用的 `metadata.name` 字段是否匹配。
|
||||
如果节点是健康的(即所有必要的服务都在运行中),则该节点可以用来运行 Pod。
|
||||
否则,直到该节点变为健康之前,所有的集群活动都会忽略该节点。
|
||||
|
||||
<!--
|
||||
Kubernetes keeps the object for the invalid Node and continues checking to see whether
|
||||
it becomes healthy.
|
||||
You, or a {{< glossary_tooltip term_id="controller" text="controller">}}, must explicitly
|
||||
delete the Node object to stop that health checking.
|
||||
-->
|
||||
{{< note >}}
|
||||
Kubernetes 会一直保存着非法节点对应的对象,并持续检查该节点是否已经
|
||||
变得健康。
|
||||
你,或者某个{{< glossary_tooltip term_id="controller" text="控制器">}}必需显式地
|
||||
删除该 Node 对象以停止健康检查操作。
|
||||
{{< /note >}}
|
||||
|
||||
<!--
|
||||
The name of a Node object must be a valid
|
||||
[DNS subdomain name](/docs/concepts/overview/working-with-objects/names#dns-subdomain-names).
|
||||
-->
|
||||
Node 对象的名称必须是合法的
|
||||
[DNS 子域名](/zh/docs/concepts/overview/working-with-objects/names#dns-subdomain-names)。
|
||||
|
||||
<!--
|
||||
### Self-registration of Nodes
|
||||
|
||||
When the kubelet flag `-register-node` is true (the default), the kubelet will attempt to
|
||||
register itself with the API server. This is the preferred pattern, used by most distros.
|
||||
|
||||
For self-registration, the kubelet is started with the following options:
|
||||
-->
|
||||
### 节点自注册
|
||||
|
||||
当 kubelet 标志 `--register-node` 为 true(默认)时,它会尝试向 API 服务注册自己。
|
||||
这是首选模式,被绝大多数发行版选用。
|
||||
|
||||
对于自注册模式,kubelet 使用下列参数启动:
|
||||
|
||||
<!--
|
||||
- `--kubeconfig` - Path to credentials to authenticate itself to the API server.
|
||||
- `--cloud-provider` - How to talk to a {{< glossary_tooltip text="cloud provider" term_id="cloud-provider" >}} to read metadata about itself.
|
||||
- `--register-node` - Automatically register with the API server.
|
||||
- `--register-with-taints` - Register the node with the given list of {{< glossary_tooltip text="taints" term_id="taint" >}} (comma separated `<key>=<value>:<effect>`).
|
||||
|
||||
No-op if `register-node` is false.
|
||||
- `--node-ip` - IP address of the node.
|
||||
- `--node-labels` - {{< glossary_tooltip text="Labels" term_id="label" >}} to add when registering the node in the cluster (see label restrictions enforced by the [NodeRestriction admission plugin](/docs/reference/access-authn-authz/admission-controllers/#noderestriction)).
|
||||
- `--node-status-update-frequency` - Specifies how often kubelet posts node status to master.
|
||||
-->
|
||||
- `--kubeconfig` - 用于向 API 服务器表明身份的凭据路径。
|
||||
- `--cloud-provider` - 与某{{< glossary_tooltip text="云驱动" term_id="cloud-provider" >}}
|
||||
进行通信以读取与自身相关的元数据的方式。
|
||||
- `--register-node` - 自动向 API 服务注册。
|
||||
- `--register-with-taints` - 使用所给的污点列表(逗号分隔的 `<key>=<value>:<effect>`)注册节点。
|
||||
当 `register-node` 为 false 时无效。
|
||||
- `--node-ip` - 节点 IP 地址。
|
||||
- `--node-labels` - 在集群中注册节点时要添加的
|
||||
{{< glossary_tooltip text="标签" term_id="label" >}}。
|
||||
(参见 [NodeRestriction 准入控制插件](/zh/docs/reference/access-authn-authz/admission-controllers/#noderestriction)所实施的标签限制)。
|
||||
- `--node-status-update-frequency` - 指定 kubelet 向控制面发送状态的频率。
|
||||
|
||||
<!--
|
||||
When the [Node authorization mode](/docs/reference/access-authn-authz/node/) and
|
||||
[NodeRestriction admission plugin](/docs/reference/access-authn-authz/admission-controllers/#noderestriction) are enabled,
|
||||
kubelets are only authorized to create/modify their own Node resource.
|
||||
-->
|
||||
启用[节点授权模式](/zh/docs/reference/access-authn-authz/node/)和
|
||||
[NodeRestriction 准入插件](/zh/docs/reference/access-authn-authz/admission-controllers/#noderestriction)
|
||||
时,仅授权 `kubelet` 创建或修改其自己的节点资源。
|
||||
|
||||
<!--
|
||||
### Manual Node administration
|
||||
|
||||
You can create and modify Node objects using
|
||||
{{< glossary_tooltip text="kubectl" term_id="kubectl" >}}.
|
||||
|
||||
When you want to create Node objects manually, set the kubelet flag `--register-node=false`.
|
||||
|
||||
You can modify Node objects regardless of the setting of `--register-node`.
|
||||
For example, you can set labels on an existing Node, or mark it unschedulable.
|
||||
-->
|
||||
#### 手动节点管理
|
||||
|
||||
你可以使用 {{< glossary_tooltip text="kubectl" term_id="kubectl" >}}
|
||||
来创建和修改 Node 对象。
|
||||
|
||||
如果你希望手动创建节点对象时,请设置 kubelet 标志 `--register-node=false`。
|
||||
|
||||
你可以修改 Node 对象(忽略 `--register-node` 设置)。
|
||||
例如,修改节点上的标签或标记其为不可调度。
|
||||
|
||||
<!--
|
||||
You can use labels on Nodes in conjunction with node selectors on Pods to control
|
||||
scheduling. For example, you can to constrain a Pod to only be eligible to run on
|
||||
a subset of the available nodes.
|
||||
|
||||
Marking a node as unschedulable prevents the scheduler from placing new pods onto
|
||||
that Node, but does not affect existing Pods on the Node. This is useful as a
|
||||
preparatory step before a node reboot or other maintenance.
|
||||
|
||||
To mark a Node unschedulable, run:
|
||||
-->
|
||||
你可以结合使用节点上的标签和 Pod 上的选择算符来控制调度。
|
||||
例如,你可以限制某 Pod 只能在符合要求的节点子集上运行。
|
||||
|
||||
如果标记节点为不可调度(unschedulable),将阻止新 Pod 调度到该节点之上,但不会
|
||||
影响任何已经在其上的 Pod。
|
||||
这是重启节点或者执行其他维护操作之前的一个有用的准备步骤。
|
||||
|
||||
要标记一个节点为不可调度,执行以下命令:
|
||||
|
||||
```shell
|
||||
kubectl cordon $NODENAME
|
||||
```
|
||||
|
||||
<!--
|
||||
Pods that are part of a {{< glossary_tooltip term_id="daemonset" >}} tolerate
|
||||
being run on an unschedulable Node. DaemonSets typically provide node-local services
|
||||
that should run on the Node even if it is being drained of workload applications.
|
||||
-->
|
||||
{{< note >}}
|
||||
被 {{< glossary_tooltip term_id="daemonset" text="DaemonSet" >}} 控制器创建的 Pod
|
||||
能够容忍节点的不可调度属性。
|
||||
DaemonSet 通常提供节点本地的服务,即使节点上的负载应用已经被腾空,这些服务也仍需
|
||||
运行在节点之上。
|
||||
{{< /note >}}
|
||||
|
||||
<!--
|
||||
## Node Status
|
||||
@@ -36,37 +226,35 @@ A node's status contains the following information:
|
||||
* [Capacity and Allocatable](#capacity)
|
||||
* [Info](#info)
|
||||
-->
|
||||
|
||||
## 节点状态
|
||||
## 节点状态 {#node-status}
|
||||
|
||||
一个节点的状态包含以下信息:
|
||||
|
||||
* [地址](#addresses)
|
||||
* [条件](#condition)
|
||||
* [状况](#condition)
|
||||
* [容量与可分配](#capacity)
|
||||
* [信息](#info)
|
||||
|
||||
<!--
|
||||
Node status and other details about a node can be displayed using below command:
|
||||
You can use `kubectl` to view a Node's status and other details:
|
||||
-->
|
||||
可以使用以下命令显示节点状态和有关节点的其他详细信息:
|
||||
你可以使用 `kubectl` 来查看节点状态和其他细节信息:
|
||||
|
||||
```shell
|
||||
kubectl describe node <insert-node-name-here>
|
||||
kubectl describe node <节点名称>
|
||||
```
|
||||
<!--
|
||||
Each section is described in detail below.
|
||||
-->
|
||||
下面对每个章节进行详细描述。
|
||||
|
||||
<!-- Each section is described in detail below. -->
|
||||
下面对每个部分进行详细描述。
|
||||
|
||||
<!--
|
||||
### Addresses
|
||||
|
||||
The usage of these fields varies depending on your cloud provider or bare metal configuration.
|
||||
-->
|
||||
### 地址
|
||||
### 地址 {#addresses}
|
||||
|
||||
这些字段组合的用法取决于你的云服务商或者裸机配置。
|
||||
这些字段的用法取决于你的云服务商或者物理机配置。
|
||||
|
||||
<!--
|
||||
* HostName: The as reported by the node's kernel. Can be overridden via the kubelet `-hostname-override` parameter.
|
||||
@@ -74,7 +262,7 @@ The usage of these fields varies depending on your cloud provider or bare metal
|
||||
* InternalIP: Typichostnameally the IP address of the node that is routable only within the cluster.
|
||||
-->
|
||||
* HostName:由节点的内核设置。可以通过 kubelet 的 `--hostname-override` 参数覆盖。
|
||||
* ExternalIP:通常是节点的可以外部路由(从集群外可访问)的 IP 地址。
|
||||
* ExternalIP:通常是节点的可外部路由(从集群外可访问)的 IP 地址。
|
||||
* InternalIP:通常是节点的仅可在集群内部路由的 IP 地址。
|
||||
|
||||
<!--
|
||||
@@ -82,29 +270,40 @@ The usage of these fields varies depending on your cloud provider or bare metal
|
||||
|
||||
The `conditions` field describes the status of all `Running` nodes. Examples of conditions include:
|
||||
-->
|
||||
### 条件 {#condition}
|
||||
### 状况 {#condition}
|
||||
|
||||
`conditions` 字段描述了所有 `Running` 节点的状态。条件的示例包括:
|
||||
`conditions` 字段描述了所有 `Running` 节点的状态。状况的示例包括:
|
||||
|
||||
<!--
|
||||
{{< table caption = "Node conditions, and a description of when each condition applies." >}}
|
||||
| Node Condition | Description |
|
||||
|----------------|-------------|
|
||||
| `OutOfDisk` | `True` if there is insufficient free space on the node for adding new pods, otherwise `False` |
|
||||
| `Ready` | `True` if the node is healthy and ready to accept pods, `False` if the node is not healthy and is not accepting pods, and `Unknown` if the node controller has not heard from the node in the last `node-monitor-grace-period` (default is 40 seconds) |
|
||||
| `DiskPressure` | `True` if there is insufficient free space on the node for adding new pods, otherwise `False` |
|
||||
| `MemoryPressure` | `True` if pressure exists on the node memory - that is, if the node memory is low; otherwise `False` |
|
||||
| `PIDPressure` | `True` if pressure exists on the processes - that is, if there are too many processes on the node; otherwise `False` |
|
||||
| `DiskPressure` | `True` if pressure exists on the disk size - that is, if the disk capacity is low; otherwise `False` |
|
||||
| `NetworkUnavailable` | `True` if the network for the node is not correctly configured, otherwise `False` |
|
||||
-->
|
||||
| 节点条件 | 描述 |
|
||||
{{< table caption = "节点状况及每种状况适用场景的描述" >}}
|
||||
| 节点状况 | 描述 |
|
||||
|----------------|-------------|
|
||||
| `OutOfDisk` | `True` 表示节点的空闲空间不足以用于添加新 Pods, 否则为 `False` |
|
||||
| `Ready` | 表示节点是健康的并已经准备好接收 Pods;`False` 表示节点不健康而且不能接收 Pods;`Unknown` 表示节点控制器在最近 `node-monitor-grace-period` 期间(默认 40 秒)没有收到节点的消息 |
|
||||
| `Ready` | 如节点是健康的并已经准备好接收 Pod 则为 `True`;`False` 表示节点不健康而且不能接收 Pod;`Unknown` 表示节点控制器在最近 `node-monitor-grace-period` 期间(默认 40 秒)没有收到节点的消息 |
|
||||
| `DiskPressure` | `True` 表示节点的空闲空间不足以用于添加新 Pod, 否则为 `False` |
|
||||
| `MemoryPressure` | `True` 表示节点存在内存压力,即节点内存可用量低,否则为 `False` |
|
||||
| `PIDPressure` | `True` 表示节点存在进程压力,即进程过多;否则为 `False` |
|
||||
| `DiskPressure` | `True` 表示节点存在磁盘压力,即磁盘可用量低,否则为 `False` |
|
||||
| `PIDPressure` | `True` 表示节点存在进程压力,即节点上进程过多;否则为 `False` |
|
||||
| `NetworkUnavailable` | `True` 表示节点网络配置不正确;否则为 `False` |
|
||||
|
||||
<!--
|
||||
If you use command-line tools to print details of a cordoned Node, the Condition includes
|
||||
`SchedulingDisabled`. `SchedulingDisabled` is not a Condition in the Kubernetes API; instead,
|
||||
cordoned nodes are marked Unschedulable in their spec.
|
||||
-->
|
||||
{{< note >}}
|
||||
如果使用命令行工具来打印已保护(Cordoned)节点的细节,其中的 Condition 字段可能
|
||||
包括 `SchedulingDisabled`。`SchedulingDisabled` 不是 Kubernetes API 中定义的
|
||||
Condition,被保护起来的节点在其规约中被标记为不可调度(Unschedulable)。
|
||||
{{< /note >}}
|
||||
|
||||
<!--
|
||||
The node condition is represented as a JSON object. For example, the following response describes a healthy node.
|
||||
-->
|
||||
@@ -124,38 +323,40 @@ The node condition is represented as a JSON object. For example, the following r
|
||||
```
|
||||
|
||||
<!--
|
||||
If the Status of the Ready condition remains `Unknown` or `False` for longer than the `pod-eviction-timeout`, an argument is passed to the [kube-controller-manager](/docs/admin/kube-controller-manager/) and all the Pods on the node are scheduled for deletion by the Node Controller. The default eviction timeout duration is **five minutes**. In some cases when the node is unreachable, the apiserver is unable to communicate with the kubelet on the node. The decision to delete the pods cannot be communicated to the kubelet until communication with the apiserver is re-established. In the meantime, the pods that are scheduled for deletion may continue to run on the partitioned node.
|
||||
If the Status of the Ready condition remains `Unknown` or `False` for longer than the `pod-eviction-timeout`, an argument is passed to the {{< glossary_tooltip text="kube-controller-manager" term_id="kube-controller-manager" >}}), all the Pods on the node are scheduled for deletion by the Node Controller. The default eviction timeout duration is **five minutes**. In some cases when the node is unreachable, the apiserver is unable to communicate with the kubelet on the node. The decision to delete the pods cannot be communicated to the kubelet until communication with the API server is re-established. In the meantime, the pods that are scheduled for deletion may continue to run on the partitioned node.
|
||||
-->
|
||||
如果 Ready 条件处于状态 `Unknown` 或者 `False` 的时间超过了 `pod-eviction-timeout`
|
||||
(一个传递给 [kube-controller-manager](/docs/admin/kube-controller-manager/) 的参数),
|
||||
节点上的所有 Pods 都会被节点控制器计划删除。默认的逐出超时时长为 **5 分钟**。
|
||||
某些情况下,当节点不可访问时,apiserver 不能和其上的 kubelet 通信。
|
||||
删除 Pods 的决定不能传达给 kubelet,直到它重新建立和 apiserver 的连接为止。
|
||||
与此同时,被计划删除的 Pods 可能会继续在游离的节点上运行。
|
||||
如果 Ready 条件处于 `Unknown` 或者 `False` 状态的时间超过了 `pod-eviction-timeout` 值,
|
||||
(一个传递给 {{< glossary_tooltip text="kube-controller-manager" term_id="kube-controller-manager" >}} 的参数),
|
||||
节点上的所有 Pod 都会被节点控制器计划删除。默认的逐出超时时长为 **5 分钟**。
|
||||
某些情况下,当节点不可达时,API 服务器不能和其上的 kubelet 通信。
|
||||
删除 Pod 的决定不能传达给 kubelet,直到它重新建立和 API 服务器的连接为止。
|
||||
与此同时,被计划删除的 Pod 可能会继续在游离的节点上运行。
|
||||
|
||||
<!--
|
||||
In versions of Kubernetes prior to 1.5, the node controller would [force delete](/docs/concepts/workloads/pods/pod/#force-deletion-of-pods)
|
||||
these unreachable pods from the apiserver. However, in 1.5 and higher, the node controller does not force delete pods until it is
|
||||
confirmed that they have stopped running in the cluster. You can see the pods that might be running on an unreachable node as being in
|
||||
the `Terminating` or `Unknown` state. In cases where Kubernetes cannot deduce from the underlying infrastructure if a node has
|
||||
permanently left a cluster, the cluster administrator may need to delete the node object by hand. Deleting the node object from
|
||||
Kubernetes causes all the Pod objects running on the node to be deleted from the apiserver, and frees up their names.
|
||||
The node controller does not force delete pods until it is confirmed that they have stopped
|
||||
running in the cluster. You can see the pods that might be running on an unreachable node as
|
||||
being in the `Terminating` or `Unknown` state. In cases where Kubernetes cannot deduce from the
|
||||
underlying infrastructure if a node has permanently left a cluster, the cluster administrator
|
||||
may need to delete the node object by hand. Deleting the node object from Kubernetes causes
|
||||
all the Pod objects running on the node to be deleted from the API server, and frees up their
|
||||
names.
|
||||
-->
|
||||
在 1.5 版本之前的 Kubernetes 上,节点控制器会将不能访问的 Pods 从 apiserver 中
|
||||
[强制删除](/docs/concepts/workloads/pods/pod/#force-deletion-of-pods)。
|
||||
但在 1.5 或更高的版本里,在节点控制器确认这些 Pods 在集群中已经停止运行前,不会强制删除它们。
|
||||
你可以看到这些可能在无法访问的节点上运行的 Pods 处于 `Terminating` 或者 `Unknown` 状态。
|
||||
如果 kubernetes 不能基于下层基础设施推断出某节点是否已经永久离开了集群,集群管理员可能需要手动删除该节点对象。
|
||||
从 Kubernetes 删除节点对象将导致 apiserver 删除节点上所有运行的 Pod 对象并释放它们的名字。
|
||||
节点控制器在确认 Pod 在集群中已经停止运行前,不会强制删除它们。
|
||||
你可以看到这些可能在无法访问的节点上运行的 Pod 处于 `Terminating` 或者 `Unknown` 状态。
|
||||
如果 kubernetes 不能基于下层基础设施推断出某节点是否已经永久离开了集群,
|
||||
集群管理员可能需要手动删除该节点对象。
|
||||
从 Kubernetes 删除节点对象将导致 API 服务器删除节点上所有运行的 Pod 对象并释放它们的名字。
|
||||
|
||||
<!--
|
||||
The node lifecycle controller automatically creates
|
||||
[taints](/docs/concepts/configuration/taint-and-toleration/) that represent conditions.
|
||||
When the scheduler is assigning a Pod to a Node, the scheduler takes the Node's taints
|
||||
into account, except for any taints that the Pod tolerates.
|
||||
[taints](/docs/concepts/scheduling-eviction/taint-and-toleration/) that represent conditions.
|
||||
The scheduler takes the Node's taints into consideration when assigning a Pod to a Node.
|
||||
Pods can also have tolerations which let them tolerate a Node's taints.
|
||||
-->
|
||||
节点生命周期控制器会自动创建代表条件的[污点](/docs/concepts/configuration/taint-and-toleration/)。
|
||||
当调度器将 Pod 指派给某节点时,调度器会考虑节点上的污点,但是 Pod 可以容忍的污点除外。
|
||||
节点生命周期控制器会自动创建代表状况的
|
||||
[污点](/zh/docs/concepts/scheduling-eviction/taint-and-toleration/)。
|
||||
当调度器将 Pod 指派给某节点时,会考虑节点上的污点。
|
||||
Pod 则可以通过容忍度(Toleration)表达所能容忍的污点。
|
||||
|
||||
<!--
|
||||
### Capacity and Allocatable {#capacity}
|
||||
@@ -165,21 +366,22 @@ number of pods that can be scheduled onto the node.
|
||||
-->
|
||||
### 容量与可分配 {#capacity}
|
||||
|
||||
描述节点上的可用资源:CPU、内存和可以调度到节点上的 Pods 的个数上限。
|
||||
描述节点上的可用资源:CPU、内存和可以调度到节点上的 Pod 的个数上限。
|
||||
|
||||
<!--
|
||||
The fields in the capacity block indicate the total amount of resources that a
|
||||
Node has. The allocatable block indicates the amount of resources on a
|
||||
Node that is available to be consumed by normal Pods.
|
||||
-->
|
||||
capacity 块中的字段指示节点拥有的资源总量。allocatable 块指示节点上可供普通 Pod 消耗的资源量。
|
||||
`capacity` 块中的字段标示节点拥有的资源总量。
|
||||
`allocatable` 块指示节点上可供普通 Pod 消耗的资源量。
|
||||
|
||||
<!--
|
||||
You may read more about capacity and allocatable resources while learning how
|
||||
to [reserve compute resources](/docs/tasks/administer-cluster/reserve-compute-resources/#node-allocatable) on a Node.
|
||||
-->
|
||||
可以在学习如何在节点上[保留计算资源](/docs/tasks/administer-cluster/reserve-compute-resources/#node-allocatable)
|
||||
的同时阅读有关容量和可分配资源的更多信息。
|
||||
可以在学习如何在节点上[预留计算资源](/zh/docs/tasks/administer-cluster/reserve-compute-resources/#node-allocatable)
|
||||
的时了解有关容量和可分配资源的更多信息。
|
||||
|
||||
<!--
|
||||
### Info
|
||||
@@ -190,82 +392,25 @@ This information is gathered by Kubelet from the node.
|
||||
|
||||
### 信息 {#info}
|
||||
|
||||
关于节点的通用信息,例如内核版本、Kubernetes 版本(kubelet 和 kube-proxy 版本)、Docker 版本
|
||||
(如果使用了)和操作系统名称。这些信息由 kubelet 从节点上搜集而来。
|
||||
|
||||
<!--
|
||||
## Management
|
||||
|
||||
Unlike [pods](/docs/concepts/workloads/pods/pod/) and [services](/docs/concepts/services-networking/service/),
|
||||
a node is not inherently created by Kubernetes: it is created externally by cloud
|
||||
providers like Google Compute Engine, or it exists in your pool of physical or virtual
|
||||
machines. So when Kubernetes creates a node, it creates
|
||||
an object that represents the node. After creation, Kubernetes
|
||||
checks whether the node is valid or not. For example, if you try to create
|
||||
a node from the following content:
|
||||
-->
|
||||
|
||||
## 管理
|
||||
与 [Pods](/docs/concepts/workloads/pods/pod/) 和 [Services](/docs/concepts/services-networking/service/) 不同,
|
||||
节点并不是在 Kubernetes 中从头创建的:它们由外部的云服务商(例如 Google Compute Engine)创建,或者是来自你的资源池
|
||||
中的物理机或者虚拟机。
|
||||
这意味着当 Kubernetes 创建一个节点时,它其实仅仅创建了一个对象来代表这个节点。
|
||||
创建以后,Kubernetes 将检查这个节点是否可用。例如,如果你尝试使用如下内容创建一个节点:
|
||||
|
||||
```json
|
||||
{
|
||||
"kind": "Node",
|
||||
"apiVersion": "v1",
|
||||
"metadata": {
|
||||
"name": "10.240.79.157",
|
||||
"labels": {
|
||||
"name": "my-first-k8s-node"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
<!--
|
||||
Kubernetes creates a node object internally (the representation), and
|
||||
validates the node by health checking based on the `metadata.name` field. If the node is valid -- that is, if all necessary
|
||||
services are running -- it is eligible to run a pod. Otherwise, it is
|
||||
ignored for any cluster activity until it becomes valid.
|
||||
-->
|
||||
Kubernetes 会在内部创一个 Node 对象(用以表示节点),并基于 `metadata.name` 字段执行健康检查,
|
||||
如果节点合法,即所有必要服务都处于运行状态,它就有资格运行 Pod;否则它将被所有的集群活动忽略直到其变为合法为止。
|
||||
|
||||
<!--
|
||||
{{< note >}}
|
||||
Kubernetes keeps the object for the invalid node and keeps checking to see whether it becomes valid.
|
||||
You must explicitly delete the Node object to stop this process.
|
||||
{{< /note >}}
|
||||
-->
|
||||
|
||||
{{< note >}}
|
||||
Kubernetes 保留无效节点所对应的对象,并持续检查它是否合法。
|
||||
若要停止这种检查,必须显式删除 Node 对象。
|
||||
{{< /note >}}
|
||||
|
||||
<!--
|
||||
Currently, there are three components that interact with the Kubernetes node
|
||||
interface: node controller, kubelet, and kubectl.
|
||||
-->
|
||||
当前,有 3 个组件同 Kubernetes 节点接口交互:节点控制器、kubelet 和 kubectl。
|
||||
关于节点的一般性信息,例如内核版本、Kubernetes 版本(`kubelet` 和 `kube-proxy` 版本)、
|
||||
Docker 版本(如果使用了)和操作系统名称。这些信息由 `kubelet` 从节点上搜集而来。
|
||||
|
||||
<!--
|
||||
### Node Controller
|
||||
|
||||
The node controller is a Kubernetes master component which manages various
|
||||
aspects of nodes.
|
||||
The node {{< glossary_tooltip text="controller" term_id="controller" >}} is a
|
||||
Kubernetes control plane component that manages various aspects of nodes.
|
||||
|
||||
The node controller has multiple roles in a node's life. The first is assigning a
|
||||
CIDR block to the node when it is registered (if CIDR assignment is turned on).
|
||||
-->
|
||||
### 节点控制器
|
||||
### 节点控制器 {#node-controller}
|
||||
|
||||
节点控制器是一个 Kubernetes 控制面组件,管理节点的方方面面。
|
||||
节点{{< glossary_tooltip text="控制器" term_id="controller" >}}是
|
||||
Kubernetes 控制面组件,管理节点的方方面面。
|
||||
|
||||
节点控制器在节点的生命周期中扮演多个角色。第一个是当节点注册时为它分配一个 CIDR 区间(如果启用了 CIDR 分配)。
|
||||
节点控制器在节点的生命周期中扮演多个角色。
|
||||
第一个是当节点注册时为它分配一个 CIDR 区段(如果启用了 CIDR 分配)。
|
||||
|
||||
<!--
|
||||
The second is keeping the node controller's internal list of nodes up to date with
|
||||
@@ -274,8 +419,8 @@ environment, whenever a node is unhealthy, the node controller asks the cloud
|
||||
provider if the VM for that node is still available. If not, the node
|
||||
controller deletes the node from its list of nodes.
|
||||
-->
|
||||
第二个保持节点控制器内部的节点列表与云服务商所提供的可用机器列表同步。
|
||||
如果在云环境下运行,当某节点不健康时,节点控制器将询问云服务是否节点的虚拟机可用。
|
||||
第二个是保持节点控制器内的节点列表与云服务商所提供的可用机器列表同步。
|
||||
如果在云环境下运行,只要某节点不健康,节点控制器就会询问云服务是否节点的虚拟机仍可用。
|
||||
如果不可用,节点控制器会将该节点从它的节点列表删除。
|
||||
|
||||
<!--
|
||||
@@ -290,9 +435,9 @@ checks the state of each node every `-node-monitor-period` seconds.
|
||||
-->
|
||||
第三个是监控节点的健康情况。节点控制器负责在节点不可达
|
||||
(即,节点控制器因为某些原因没有收到心跳,例如节点宕机)时,
|
||||
将它的 NodeStatus 的 NodeReady 条件更新为 ConditionUnknown。
|
||||
后续如果节点持续不可达,节点控制器将逐出节点上的所有 Pods(使用体面终止)。
|
||||
(默认情况下 40s 后开始报告 ConditionUnknown,在那之后 5m 开始逐出 Pods。)
|
||||
将节点状态的 `NodeReady` 状况更新为 "`Unknown`"。
|
||||
如果节点接下来持续处于不可达状态,节点控制器将逐出节点上的所有 Pod(使用体面终止)。
|
||||
默认情况下 40 秒后开始报告 "`Unknown`",在那之后 5 分钟开始逐出 Pod。
|
||||
节点控制器每隔 `--node-monitor-period` 秒检查每个节点的状态。
|
||||
|
||||
<!--
|
||||
@@ -306,18 +451,20 @@ Each Node has an associated Lease object in the `kube-node-lease`
|
||||
Lease is a lightweight resource, which improves the performance
|
||||
of the node heartbeats as the cluster scales.
|
||||
-->
|
||||
#### 心跳机制
|
||||
#### 心跳机制 {#heartbeats}
|
||||
|
||||
Kubernetes 节点发送的心跳有助于确定节点的可用性。
|
||||
心跳有两种形式:`NodeStatus` 和 [`Lease` 对象](/docs/reference/generated/kubernetes-api/{{< latest-version >}}/#lease-v1-coordination-k8s-io)。
|
||||
每个节点在 `kube-node-lease`{{< glossary_tooltip term_id="namespace" text="命名空间">}} 中都有一个关联的 `Lease` 对象。
|
||||
`Lease` 是一种轻量级的资源,可在集群扩展时提高节点心跳机制的性能。
|
||||
Kubernetes 节点发送的心跳(Heartbeats)有助于确定节点的可用性。
|
||||
心跳有两种形式:`NodeStatus` 和 [`Lease` 对象]
|
||||
(/docs/reference/generated/kubernetes-api/{{< latest-version >}}/#lease-v1-coordination-k8s-io)。
|
||||
每个节点在 `kube-node-lease`{{< glossary_tooltip term_id="namespace" text="名字空间">}}
|
||||
中都有一个与之关联的 `Lease` 对象。
|
||||
`Lease` 是一种轻量级的资源,可在集群规模扩大时提高节点心跳机制的性能。
|
||||
|
||||
<!--
|
||||
The kubelet is responsible for creating and updating the `NodeStatus` and
|
||||
a Lease object.
|
||||
-->
|
||||
kubelet 负责创建和更新 `NodeStatus` 和 `Lease` 对象。
|
||||
`kubelet` 负责创建和更新 `NodeStatus` 和 `Lease` 对象。
|
||||
|
||||
<!--
|
||||
- The kubelet updates the `NodeStatus` either when there is change in status,
|
||||
@@ -326,35 +473,28 @@ kubelet 负责创建和更新 `NodeStatus` 和 `Lease` 对象。
|
||||
timeout for unreachable nodes).
|
||||
- The kubelet creates and then updates its Lease object every 10 seconds
|
||||
(the default update interval). Lease updates occur independently from the
|
||||
`NodeStatus` updates.
|
||||
`NodeStatus` updates. If the Lease update fails, the kubelet retries with
|
||||
exponential backoff starting at 200 milliseconds and capped at 7 seconds.
|
||||
|
||||
-->
|
||||
- 当状态发生变化时,或者在配置的时间间隔内没有更新时,kubelet 会更新 `NodeStatus`。
|
||||
- 当状态发生变化时,或者在配置的时间间隔内没有更新事件时,kubelet 会更新 `NodeStatus`。
|
||||
`NodeStatus` 更新的默认间隔为 5 分钟(比不可达节点的 40 秒默认超时时间长很多)。
|
||||
- kubelet 会每 10 秒(默认更新间隔时间)创建并更新其 `Lease` 对象。`Lease` 更新独立于 `NodeStatus` 更新而发生。
|
||||
- `kubelet` 会每 10 秒(默认更新间隔时间)创建并更新其 `Lease` 对象。
|
||||
`Lease` 更新独立于 `NodeStatus` 更新而发生。
|
||||
如果 `Lease` 的更新操作失败,`kubelet` 会采用指数回退机制,从 200 毫秒开始
|
||||
重试,最长重试间隔为 7 秒钟。
|
||||
|
||||
<!--
|
||||
#### Reliability
|
||||
|
||||
In Kubernetes 1.4, we updated the logic of the node controller to better handle
|
||||
cases when a large number of nodes have problems with reaching the master
|
||||
(e.g. because the master has networking problem). Starting with 1.4, the node
|
||||
controller looks at the state of all nodes in the cluster when making a
|
||||
decision about pod eviction.
|
||||
-->
|
||||
#### 可靠性
|
||||
|
||||
在 Kubernetes 1.4 中我们更新了节点控制器逻辑以更好地处理大批量节点访问控制面而出问题的情况
|
||||
(例如,控制面节点的网络出了问题)。从 1.4 开始,节点控制器在决定逐出 Pod 之前
|
||||
会检查集群中所有节点的状态。
|
||||
|
||||
<!--
|
||||
In most cases, node controller limits the eviction rate to
|
||||
`-node-eviction-rate` (default 0.1) per second, meaning it won't evict pods
|
||||
from more than 1 node per 10 seconds.
|
||||
-->
|
||||
#### 可靠性 {#reliability}
|
||||
|
||||
大部分情况下,节点控制器把驱逐速率限制在每秒 `--node-eviction-rate` 个(默认为 0.1)。
|
||||
这表示它每 10 秒钟内至多从一个节点驱逐 Pods。
|
||||
大部分情况下,节点控制器把逐出速率限制在每秒 `--node-eviction-rate` 个(默认为 0.1)。
|
||||
这表示它每 10 秒钟内至多从一个节点驱逐 Pod。
|
||||
|
||||
<!--
|
||||
The node eviction behavior changes when a node in a given availability zone
|
||||
@@ -372,11 +512,13 @@ your cluster does not span multiple cloud provider availability zones, then
|
||||
there is only one availability zone (the whole cluster).
|
||||
-->
|
||||
当一个可用区域(Availability Zone)中的节点变为不健康时,节点的驱逐行为将发生改变。
|
||||
节点控制器会同时检查可用区域中不健康(NodeReady 状态为 ConditionUnknown 或 ConditionFalse)
|
||||
节点控制器会同时检查可用区域中不健康(NodeReady 状况为 Unknown 或 False)
|
||||
的节点的百分比。如果不健康节点的比例超过 `--unhealthy-zone-threshold` (默认为 0.55),
|
||||
驱逐速率将会降低:如果集群较小(意即小于等于 `--large-cluster-size-threshold` 个节点 - 默认为 50),
|
||||
驱逐操作将会停止,否则驱逐速率将降为每秒 `--secondary-node-eviction-rate` 个(默认为 0.01)。
|
||||
在单个可用区域实施这些策略的原因是当一个可用区域可能从控制面脱离时其它可用区域可能仍然保持连接。
|
||||
驱逐速率将会降低:如果集群较小(意即小于等于 `--large-cluster-size-threshold`
|
||||
个节点 - 默认为 50),驱逐操作将会停止,否则驱逐速率将降为每秒
|
||||
`--secondary-node-eviction-rate` 个(默认为 0.01)。
|
||||
在单个可用区域实施这些策略的原因是当一个可用区域可能从控制面脱离时其它可用区域
|
||||
可能仍然保持连接。
|
||||
如果你的集群没有跨越云服务商的多个可用区域,那(整个集群)就只有一个可用区域。
|
||||
|
||||
<!--
|
||||
@@ -388,188 +530,108 @@ completely unhealthy (i.e. there are no healthy nodes in the cluster). In such
|
||||
case, the node controller assumes that there's some problem with master
|
||||
connectivity and stops all evictions until some connectivity is restored.
|
||||
-->
|
||||
跨多个可用区域部署你的节点的一个关键原因是当某个可用区域整体出现故障时,工作负载可以转移到健康的可用区域。
|
||||
因此,如果一个可用区域中的所有节点都不健康时,节点控制器会以正常的速率 `--node-eviction-rate` 进行驱逐操作。
|
||||
在所有的可用区域都不健康(也即集群中没有健康节点)的极端情况下,节点控制器将假设控制面节点的连接出了某些问题,
|
||||
跨多个可用区域部署你的节点的一个关键原因是当某个可用区域整体出现故障时,
|
||||
工作负载可以转移到健康的可用区域。
|
||||
因此,如果一个可用区域中的所有节点都不健康时,节点控制器会以正常的速率
|
||||
`--node-eviction-rate` 进行驱逐操作。
|
||||
在所有的可用区域都不健康(也即集群中没有健康节点)的极端情况下,
|
||||
节点控制器将假设控制面节点的连接出了某些问题,
|
||||
它将停止所有驱逐动作直到一些连接恢复。
|
||||
|
||||
<!--
|
||||
Starting in Kubernetes 1.6, the NodeController is also responsible for evicting
|
||||
pods that are running on nodes with `NoExecute` taints, when the pods do not tolerate
|
||||
the taints. Additionally, as an alpha feature that is disabled by default, the
|
||||
NodeController is responsible for adding taints corresponding to node problems like
|
||||
node unreachable or not ready. See [this documentation](/docs/concepts/configuration/taint-and-toleration/)
|
||||
for details about `NoExecute` taints and the alpha feature.
|
||||
The Node Controller is also responsible for evicting pods running on nodes with
|
||||
`NoExecute` taints, unless the pods do not tolerate the taints.
|
||||
The Node Controller also adds {{< glossary_tooltip text="taints" term_id="taint" >}}
|
||||
corresponding to node problems like node unreachable or not ready. This means
|
||||
that the scheduler won't place Pods onto unhealthy nodes.
|
||||
-->
|
||||
从 Kubernetes 1.6 开始,NodeController 还负责驱逐运行在拥有 `NoExecute` 污点的节点上的 Pods,如果这些 Pods 没有容忍这些污点。
|
||||
此外,作为一个默认禁用的 alpha 特性,NodeController 还负责根据节点故障(例如节点不可访问或没有就绪)为其添加污点。
|
||||
请查看[这个文档](/docs/concepts/configuration/assign-pod-node/#taints-and-tolerations-beta-feature)了解 `NoExecute` 污点
|
||||
和这个 alpha 特性。
|
||||
节点控制器还负责驱逐运行在拥有 `NoExecute` 污点的节点上的 Pod,
|
||||
除非这些 Pod 能够容忍此污点。
|
||||
节点控制器还负责根据节点故障(例如节点不可访问或没有就绪)为其添加
|
||||
{{< glossary_tooltip text="污点" term_id="taint" >}}。
|
||||
这意味着调度器不会将 Pod 调度到不健康的节点上。
|
||||
|
||||
<!--
|
||||
Starting in version 1.8, the node controller can be made responsible for creating taints that represent
|
||||
Node conditions. This is an alpha feature of version 1.8.
|
||||
`kubectl cordon` marks a node as 'unschedulable', which has the side effect of the service
|
||||
controller removing the node from any LoadBalancer node target lists it was previously
|
||||
eligible for, effectively removing incoming load balancer traffic from the cordoned node(s).
|
||||
-->
|
||||
从版本 1.8 开始,可以使节点控制器负责创建代表节点条件的污点。这是版本 1.8 的 Alpha 功能。
|
||||
|
||||
<!--
|
||||
### Self-Registration of Nodes
|
||||
|
||||
When the kubelet flag `-register-node` is true (the default), the kubelet will attempt to
|
||||
register itself with the API server. This is the preferred pattern, used by most distros.
|
||||
-->
|
||||
### 节点自注册
|
||||
|
||||
当 kubelet 标志 `--register-node` 为 true (默认)时,它会尝试向 API 服务注册自己。
|
||||
这是首选模式,被绝大多数发行版选用。
|
||||
|
||||
<!--
|
||||
For self-registration, the kubelet is started with the following options:
|
||||
-->
|
||||
对于自注册模式,kubelet 使用下列参数启动:
|
||||
|
||||
<!--
|
||||
- `-kubeconfig` - Path to credentials to authenticate itself to the apiserver.
|
||||
- `-cloud-provider` - How to talk to a cloud provider to read metadata about itself.
|
||||
- `-register-node` - Automatically register with the API server.
|
||||
- `-register-with-taints` - Register the node with the given list of taints (comma separated `<key>=<value>:<effect>`). No-op if `register-node` is false.
|
||||
- `-node-ip` - IP address of the node.
|
||||
- `-node-labels` - Labels to add when registering the node in the cluster (see label restrictions enforced by the [NodeRestriction admission plugin](/docs/reference/access-authn-authz/admission-controllers/#noderestriction) in 1.13+).
|
||||
- `-node-status-update-frequency` - Specifies how often kubelet posts node status to master.
|
||||
-->
|
||||
- `--kubeconfig` - 用于向 apiserver 表明身份的凭据路径。
|
||||
- `--cloud-provider` - 如何从云服务商读取关于自己的元数据。
|
||||
- `--register-node` - 自动向 API 服务注册。
|
||||
- `--register-with-taints` - 使用污点列表(逗号分隔的 `<key>=<value>:<effect>`)注册节点。当 `register-node` 为 false 时无效。
|
||||
- `--node-ip` - 节点 IP 地址。
|
||||
- `--node-labels` - 在集群中注册节点时要添加的标签(请参阅
|
||||
[NodeRestriction 准入插件](/docs/reference/access-authn-authz/admission-controllers/#noderestriction) 在 1.13+ 中实施的标签限制)。
|
||||
- `--node-status-update-frequency` - 指定 kubelet 向控制面组件发送状态的频率。
|
||||
|
||||
<!--
|
||||
When the [Node authorization mode](/docs/reference/access-authn-authz/node/) and
|
||||
[NodeRestriction admission plugin](/docs/reference/access-authn-authz/admission-controllers/#noderestriction) are enabled,
|
||||
kubelets are only authorized to create/modify their own Node resource.
|
||||
-->
|
||||
启用[节点授权模式](/docs/reference/access-authn-authz/node/) 和
|
||||
[NodeRestriction 准入插件](/docs/reference/access-authn-authz/admission-controllers/#noderestriction)时,
|
||||
仅授权 kubelet 创建或修改其自己的节点资源。
|
||||
|
||||
<!--
|
||||
#### Manual Node Administration
|
||||
A cluster administrator can create and modify node objects.
|
||||
-->
|
||||
#### 手动节点管理
|
||||
|
||||
集群管理员可以创建及修改节点对象。
|
||||
|
||||
<!--
|
||||
If the administrator wishes to create node objects manually, set the kubelet flag `-register-node=false`.
|
||||
-->
|
||||
如果管理员希望手动创建节点对象,请设置 kubelet 标志 `--register-node=false`。
|
||||
|
||||
<!--
|
||||
The administrator can modify node resources (regardless of the setting of `-register-node`).
|
||||
Modifications include setting labels on the node and marking it unschedulable.
|
||||
-->
|
||||
管理员可以修改节点资源(忽略 `--register-node` 设置)。修改包括在节点上设置标签及
|
||||
标记它为不可调度。
|
||||
|
||||
<!--
|
||||
Labels on nodes can be used in conjunction with node selectors on pods to control scheduling,
|
||||
e.g. to constrain a pod to only be eligible to run on a subset of the nodes.
|
||||
-->
|
||||
节点上的标签可以和 Pods 的节点选择算符一起使用来控制调度,例如限制某 pod 只能在符合要求的节点子集上运行。
|
||||
|
||||
<!--
|
||||
Marking a node as unschedulable prevents new pods from being scheduled to that
|
||||
node, but does not affect any existing pods on the node. This is useful as a
|
||||
preparatory step before a node reboot, etc. For example, to mark a node
|
||||
unschedulable, run this command:
|
||||
-->
|
||||
如果标记节点为不可调度的(unschedulable),将阻止新 Pods 调度到该节点之上,但不会影响任何已经在其上的 Pods。
|
||||
这是重启节点等操作之前的一个有用的准备步骤。例如,要标记一个节点为不可调度的,执行以下命令:
|
||||
|
||||
```shell
|
||||
kubectl cordon $NODENAME
|
||||
```
|
||||
|
||||
<!--
|
||||
{{< note >}}
|
||||
Pods created by a DaemonSet controller bypass the Kubernetes scheduler
|
||||
and do not respect the unschedulable attribute on a node. This assumes that daemons belong on
|
||||
the machine even if it is being drained of applications while it prepares for a reboot
|
||||
{{< /note >}}
|
||||
-->
|
||||
|
||||
{{< note >}}
|
||||
请注意,被 DaemonSet 控制器创建的 Pods 将忽略 Kubernetes 调度器,且不会遵照节点上不可调度的属性。
|
||||
这个假设基于守护程序属于节点机器,即使在准备重启而隔离应用的时候。
|
||||
{{< /note >}}
|
||||
{{< caution>}}
|
||||
`kubectl cordon` 会将节点标记为“不可调度(Unschedulable)”。
|
||||
此操作的副作用是,服务控制器会将该节点从负载均衡器中之前的目标节点列表中移除,
|
||||
从而使得来自负载均衡器的网络请求不会到达被保护起来的节点。
|
||||
{{< /caution>}}
|
||||
|
||||
<!--
|
||||
### Node capacity
|
||||
|
||||
The capacity of the node (number of cpus and amount of memory) is part of the node object.
|
||||
Normally, nodes register themselves and report their capacity when creating the node object. If
|
||||
you are doing [manual node administration](#manual-node-administration), then you need to set node
|
||||
capacity when adding a node.
|
||||
Node objects track information about the Node's resource capacity (for example: the amount
|
||||
of memory available, and the number of CPUs).
|
||||
Nodes that [self register](#self-registration-of-nodes) report their capacity during
|
||||
registration. If you [manually](#manual-node-administration) add a Node, then
|
||||
you need to set the node's capacity information when you add it.
|
||||
-->
|
||||
### 节点容量
|
||||
### 节点容量 {#node-capacity}
|
||||
|
||||
节点的容量(cpu 数量和内存容量)是节点对象的一部分。
|
||||
通常情况下,在创建节点对象时,它们会注册自己并报告自己的容量。
|
||||
如果你正在执行[手动节点管理](#manual-node-administration),那么你需要在添加节点时手动设置节点容量。
|
||||
Node 对象会跟踪节点上资源的容量(例如可用内存和 CPU 数量)。
|
||||
通过[自注册](#self-registration-of-nodes)机制生成的 Node 对象会在注册期间报告自身容量。
|
||||
如果你[手动](#manual-node-administration)添加了 Node,你就需要在添加节点时
|
||||
手动设置节点容量。
|
||||
|
||||
<!--
|
||||
The Kubernetes scheduler ensures that there are enough resources for all the pods on a node. It
|
||||
checks that the sum of the requests of containers on the node is no greater than the node capacity. It
|
||||
includes all containers started by the kubelet, but not containers started directly by the [container runtime](/docs/concepts/overview/components/#node-components) nor any process running outside of the containers.
|
||||
The Kubernetes {{< glossary_tooltip text="scheduler" term_id="kube-scheduler" >}} ensures that
|
||||
there are enough resources for all the pods on a node. The scheduler checks that the sum
|
||||
of the requests of containers on the node is no greater than the node capacity.
|
||||
The sum of requests includes all containers started by the kubelet, but excludes any
|
||||
containers started directly by the container runtime, and also excludes any
|
||||
process running outside of the kubelet's control.
|
||||
-->
|
||||
Kubernetes 调度器保证一个节点上有足够的资源供其上的所有 Pods 使用。
|
||||
它会检查节点上所有容器的请求的总和不会超过节点的容量。
|
||||
这包括由 kubelet 启动的所有容器,但不包括由[容器运行时](/docs/concepts/overview/components/#node-components)
|
||||
直接启动的容器,也不包括在容器外部运行的任何进程。
|
||||
Kubernetes {{< glossary_tooltip text="调度器" term_id="kube-scheduler" >}}保证节点上
|
||||
有足够的资源供其上的所有 Pod 使用。它会检查节点上所有容器的请求的总和不会超过节点的容量。
|
||||
总的请求包括由 kubelet 启动的所有容器,但不包括由容器运行时直接启动的容器,
|
||||
也不包括不受 `kubelet` 控制的其他进程。
|
||||
|
||||
<!--
|
||||
If you want to explicitly reserve resources for non-Pod processes, follow this tutorial to
|
||||
[reserve resources for system daemons](/docs/tasks/administer-cluster/reserve-compute-resources/#system-reserved).
|
||||
-->
|
||||
如果要为非 Pod 进程显式保留资源。请参考[为系统守护程序保留资源](/docs/tasks/administer-cluster/reserve-compute-resources/#system-reserved)教程。
|
||||
{{< note >}}
|
||||
如果要为非 Pod 进程显式保留资源。请参考
|
||||
[为系统守护进程预留资源](/zh/docs/tasks/administer-cluster/reserve-compute-resources/#system-reserved)。
|
||||
{{< /note >}}
|
||||
|
||||
<!--
|
||||
## Node topology
|
||||
-->
|
||||
## 节点拓扑
|
||||
## 节点拓扑 {#node-topology}
|
||||
|
||||
{{< feature-state state="alpha" >}}
|
||||
{{< feature-state state="alpha" for_k8s_version="v1.16" >}}
|
||||
|
||||
<!--
|
||||
If you have enabled the `TopologyManager`
|
||||
[feature gate](/docs/reference/command-line-tools-reference/feature-gates/), then
|
||||
the kubelet can use topology hints when making resource assignment decisions.
|
||||
See [Control Topology Management Policies on a Node](/docs/tasks/administer-cluster/topology-manager/)
|
||||
for more information.
|
||||
-->
|
||||
如果启用了 `TopologyManager` [特性门控](/docs/reference/command-line-tools-reference/feature-gates/),
|
||||
则 kubelet 可以在做出资源分配决策时使用拓扑提示。
|
||||
|
||||
<!--
|
||||
## API Object
|
||||
|
||||
Node is a top-level resource in the Kubernetes REST API. More details about the
|
||||
API object can be found at:
|
||||
[Node API object](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#node-v1-core).
|
||||
-->
|
||||
## API 对象
|
||||
|
||||
节点是 Kubernetes REST API 的顶级资源。
|
||||
更多关于 API 对象的细节可以在这里找到:[节点 API 对象](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#node-v1-core)。
|
||||
如果启用了 `TopologyManager` [特性门控](/zh/docs/reference/command-line-tools-reference/feature-gates/),
|
||||
`kubelet` 可以在作出资源分配决策时使用拓扑提示。
|
||||
参考[控制节点上拓扑管理策略](/zh/docs/tasks/administer-cluster/topology-manager/)
|
||||
了解详细信息。
|
||||
|
||||
## {{% heading "whatsnext" %}}
|
||||
|
||||
<!--
|
||||
* Read about [node components](https://kubernetes.io/docs/concepts/overview/components/#node-components)
|
||||
* Read about node-level topology: [Control Topology Management Policies on a node](/docs/tasks/administer-cluster/topology-manager/)
|
||||
* Learn about the [components](/docs/concepts/overview/components/#node-components) that make up a node.
|
||||
* Read the [API definition for Node](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#node-v1-core).
|
||||
* Read the [Node](https://git.k8s.io/community/contributors/design-proposals/architecture/architecture.md#the-kubernetes-node)
|
||||
section of the architecture design document.
|
||||
* Read about [taints and tolerations](/docs/concepts/scheduling-eviction/taint-and-toleration/).
|
||||
* Read about [cluster autoscaling](/docs/tasks/administer-cluster/cluster-management/#cluster-autoscaling).
|
||||
-->
|
||||
* 了解有关[节点组件](/docs/concepts/overview/components/#node-components)的信息。
|
||||
* 阅读有关节点级拓扑的信息:[控制节点上的拓扑管理策略](/docs/tasks/administer-cluster/topology-manager/)。
|
||||
* 了解有关节点[组件](/zh/docs/concepts/overview/components/#node-components)
|
||||
* 阅读[节点的 API 定义](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#node-v1-core)
|
||||
* 阅读架构设计文档中有关[节点](https://git.k8s.io/community/contributors/design-proposals/architecture/architecture.md#the-kubernetes-node)的章节
|
||||
* 了解[污点和容忍度](/zh/docs/concepts/scheduling-eviction/taint-and-toleration/)
|
||||
* 了解[集群自动扩缩](/zh/docs/tasks/administer-cluster/cluster-management/#cluster-autoscaling)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user