Merge pull request #124430 from AllenXu93/fix-kubelet-restart-notReady

fix node notReady in first sync period after kubelet restart
This commit is contained in:
Kubernetes Prow Robot 2024-07-23 21:20:40 -07:00 committed by GitHub
commit 57d197fb89
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1660,7 +1660,13 @@ func (kl *Kubelet) Run(updates <-chan kubetypes.PodUpdate) {
// Introduce some small jittering to ensure that over time the requests won't start
// accumulating at approximately the same time from the set of nodes due to priority and
// fairness effect.
go wait.JitterUntil(kl.syncNodeStatus, kl.nodeStatusUpdateFrequency, 0.04, true, wait.NeverStop)
go func() {
// Call updateRuntimeUp once before syncNodeStatus to make sure kubelet had already checked runtime state
// otherwise when restart kubelet, syncNodeStatus will report node notReady in first report period
kl.updateRuntimeUp()
wait.JitterUntil(kl.syncNodeStatus, kl.nodeStatusUpdateFrequency, 0.04, true, wait.NeverStop)
}()
go kl.fastStatusUpdateOnce()
// start syncing lease