kubelet默认会每5分钟一次更新node status,包括更新lastHeartbeatTime。 更新周期是由node-status-update-frequency 控制的
// syncNodeStatus should be called periodically from a goroutine.// It synchronizes node status to master if there is any change or enough time// passed from the last sync, registering the kubelet first if necessary.func (kl *Kubelet) syncNodeStatus() {kl.syncNodeStatusMux.Lock()defer kl.syncNodeStatusMux.Unlock()if kl.kubeClient == nil || kl.heartbeatClient == nil {return}if kl.registerNode {// This will exit immediately if it doesn't need to do anything.kl.registerWithAPIServer()}if err := kl.updateNodeStatus(); err != nil {klog.ErrorS(err, "Unable to update node status")}}
lease
为了减轻apiserver、etcd的压力,使用lease来做更短的心跳保持。
kubelet中有nodeLeaseController,默认每10s一次,定时更新lease信息。
