就<td>
<mat-form-field>
<mat-label>Name</mat-label>
<input matInput placeholder="Name" formControlName="name" autocomplete="off" required>
</mat-form-field>
<mat-error *ngIf="form.controls['name'].hasError('invalidName')">
Special characters not allowed!
</mat-error>
</td>
和kubelet
之间的交互作用而言,我试图更好地了解Kubernetes Pod的调度和创建过程如何工作。
我知道Kubernetes调度程序会选择一个节点来分配新的Pod并将此通知API服务器。但是,我不清楚API服务器如何通知有关节点上的kube-apiserver
来启动Pod。 kubelet
中是否有查询API服务器更改的轮询过程?还是有事件监听器/回调类型交互?
如果有人知道答案,或者可以指出一些文档的方向,将不胜感激!
答案 0 :(得分:3)
阿里巴巴有一个really insightful blog post on the inner workings of the scheduler。来自博客:
调度程序基本上是这样的:
关于Kubelet轮询:实际上,API服务器支持使用WebSocket协议的“监视”模式。这样,当主机名等于Kubelet的主机名的Pod发生任何更改时,便会通知Kubelet。
答案 1 :(得分:2)
没有链接到源代码的答案,但是我确定kubelet
的工作方式如下:
watch
放在列表中PodScheduled
状态的grep吊舱spec.nodeName==$hostname
Query Parameters
...
watch Watch for changes to the described resources and return them as a stream of add, update, and remove notifications. Specify resourceVersion.
手表功能继承自etcd(API服务器后面的数据库):https://etcd.io/docs/v3.2.17/learning/api/。参见Watch streams
:
Watches are long running requests and use gRPC streams to stream event data.
这是一种长时间的轮询。