[英]Kubernetes Control Plane communication
I am researching the K8s architecture, focusing on the flow of pod spinning in the system.我正在研究 K8s 架构,重点研究系统中 pod 旋转的流程。
I was wondering how (that is, who is initiating the communication) and when the different components of the control plane communicate with each other.我想知道控制平面的不同组件如何(即谁发起通信)以及何时相互通信。
I have followed the excellent talk of Jérôme Petazzoni at LISA 2019 ( here ) to understand the architecture of the control plane, and read the concepts on kubernetes.io .我关注了Jérôme Petazzoni在 LISA 2019 上的精彩演讲(此处)以了解控制平面的架构,并阅读了kubernetes.io上的概念。
However, I still haven't found the answers to the following questions:但是,我仍然没有找到以下问题的答案:
Node objects track information about the Node's resource capacity: for example, the amount of memory available and the number of CPUs.
节点对象跟踪有关节点资源容量的信息:例如,可用内存量和 CPU 数量。 Nodes that self-register report their capacity during registration.
自行注册的节点在注册期间报告其容量。 If you manually add a Node, then you need to set the node's capacity information when you add it.
如果手动添加一个Node,那么在添加的时候需要设置该节点的容量信息。
However, there is no specification on when does it update at etcd
, and who initiates the regular update (other than the heartbeat that updates the status of the node).但是,没有关于它何时在
etcd
更新以及谁发起定期更新(更新节点状态的心跳除外)的规范。
Also, when does the cache of the scheduler update?另外,调度程序的缓存什么时候更新?
controller-manager
/ scheduler
"knows" when it suppose to do its job?controller-manager
/ scheduler
controller-manager
如何“知道”它应该何时完成其工作? Each request is written as a manifest in etcd
by the kube-api-server
, but these components aren't connected to etcd
directly.kube-api-server
写入etcd
的清单,但这些组件不直接连接到etcd
。 Does that mean the API-Server needs to inform each component about each new request?这是否意味着 API-Server 需要将每个新请求通知每个组件?
I have many possible answers, but not a concrete confirmation of the real process in current K8s architecture.我有很多可能的答案,但没有具体确认当前 K8s 架构中的真实过程。
Answering your questions:回答您的问题:
Who initiates the resource check of each node?每个节点的资源检查谁来发起?
The component responsible for that is "Node Status Manager" which is a sub-control loop of the " SyncLoop" which is a kubelet agent component.对此负责的组件是“节点状态管理器” ,它是kubelet 代理组件“ SyncLoop”的子控制循环。
The more detailed answer is in this article: Kubernetes Deep Dive: Kubelet :更详细的答案在这篇文章中: Kubernetes Deep Dive:Kubelet :
As you can see, the core of
kubelet
's work is a control loop, namely: SyncLoop .可以看到,
kubelet
的工作核心是一个控制循环,即: SyncLoop 。
For example, the Node Status Manager is responsible for responding to changes in the status of the
Node
, and then collecting the status of theNode
and reporting it to theAPIServer
through Heartbeat.例如,节点状态管理器是负责应对变化中的状态
Node
,然后收集的状态Node
,并将其报告给APIServer
通过心跳。
There is also a good diagram:还有一个很好的图:
Answering second part:回答第二部分:
Who informs the different components about new pending requests?谁通知不同组件有关新的待处理请求? That is, how is the
controller-manager
/ scheduler
"knows" when it suppose to do its job?也就是说,
controller-manager
/ scheduler
controller-manager
如何“知道”它应该何时完成其工作?
The components responsible for that are Kubernetes' controllers and Scheduler itself.对此负责的组件是Kubernetes 的控制器和调度程序本身。 Good examples and explanations are in this article: What happens when ... Kubernetes edition!
这篇文章中有很好的例子和解释:当...... Kubernetes 版时会发生什么! ,
,
Basically after Kubernetes verified the request (authentication, authorization, admission control stuff), it is saved to datastore ( etcd
), and then it's taken by initializers which may perform some additional logic on the resource (not always), after that it's visible via kube-server.基本上在 Kubernetes 验证请求(身份验证、授权、准入控制)之后,它被保存到数据存储(
etcd
),然后它被初始化器获取,它可能对资源执行一些额外的逻辑(并不总是),之后它是可见的kube 服务器。 Main part that may interest you is Control loops .您可能感兴趣的主要部分是Control loops 。 They are constantly checking if a new request exists in a datastore, and if yes they are proceeding.
他们不断检查数据存储中是否存在新请求,如果是,他们正在继续。 Example - when you are deploying a new deployment:
示例 - 当您部署新部署时:
For more details I'd strongly suggest reading the earlier mentioned article - What happens when ... Kubernetes edition!有关更多详细信息,我强烈建议您阅读前面提到的文章 -当 ... Kubernetes 版时会发生什么! .
.
Does that mean the API-Server needs to inform each component about each new request?这是否意味着 API-Server 需要将每个新请求通知每个组件?
It works in a different way - the kube-apiserver is making requests to be visible, and controllers, which are loops, are detecting new requests and starting to proceed with them.它以不同的方式工作 - kube-apiserver 使请求可见,控制器(循环)正在检测新请求并开始处理它们。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.