Kubernetes 简明教程

Kubernetes - Node

节点是 Kubernetes 群集中的工作机器,也称为 Minion。它们是工作单元,可以是物理机、虚拟机或云实例。

A node is a working machine in Kubernetes cluster which is also known as a minion. They are working units which can be physical, VM, or a cloud instance.

每个节点都具有在上面运行 Pod 所需的所有必需配置,例如代理服务和 kubelet 服务以及 Docker,该服务用于在节点上创建的 Pod 中运行 Docker 容器。

Each node has all the required configuration required to run a pod on it such as the proxy service and kubelet service along with the Docker, which is used to run the Docker containers on the pod created on the node.

它们不是由 Kubernetes 创建的,而是由云服务提供商或 Kubernetes 群集管理器在物理机或虚拟机上从外部创建的。

They are not created by Kubernetes but they are created externally either by the cloud service provider or the Kubernetes cluster manager on physical or VM machines.

Kubernetes 处理多个节点的关键组件是控制器管理器,它运行多种控制器来管理节点。为了管理节点,Kubernetes 创建一个 kind 为“节点”的对象,它将验证所创建的对象是否为有效的节点。

The key component of Kubernetes to handle multiple nodes is the controller manager, which runs multiple kind of controllers to manage nodes. To manage nodes, Kubernetes creates an object of kind node which will validate that the object which is created is a valid node.

Service with Selector

apiVersion: v1
kind: node
metadata:
   name: < ip address of the node>
   labels:
      name: <lable name>

实际对象以 JSON 格式创建,如下所示:

In JSON format the actual object is created which looks as follows −

{
   Kind: node
   apiVersion: v1
   "metadata":
   {
      "name": "10.01.1.10",
      "labels"
      {
         "name": "cluster 1 node"
      }
   }
}

Node Controller

它们是一系列服务,在 Kubernetes 主服务器中运行并根据 metadata.name 持续监控群集中的节点。如果所有必需的服务都在运行,则该节点被验证,且控制器会将新创建的 Pod 分配给该节点。如果它无效,则主节点不会为其分配任何 Pod,并会等到它变为有效为止。

They are the collection of services which run in the Kubernetes master and continuously monitor the node in the cluster on the basis of metadata.name. If all the required services are running, then the node is validated and a newly created pod will be assigned to that node by the controller. If it is not valid, then the master will not assign any pod to it and will wait until it becomes valid.

如果 –register-node 标志为 true,Kubernetes 主服务器会自动注册节点。

Kubernetes master registers the node automatically, if –register-node flag is true.

–register-node = true

但是,如果群集管理员希望手动管理它,可以通过开启以下 flat:

However, if the cluster administrator wants to manage it manually then it could be done by turning the flat of −

–register-node = false