mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-10 04:27:54 +00:00
kubeadm: speedup init by 0s or 20s
Before this commit, kubeadm starts kubelet before it creates /etc/kubernetes/manifests. On boot, kubelet tries to load the static pod manifests from this dir by calling `listConfig()`7ad8303b96/pkg/kubelet/config/file.go (L97)
and it'll then try to start a file watcher every second for 20s7ad8303b96/pkg/kubelet/config/file.go (L114)
7ad8303b96/pkg/kubelet/config/file_linux.go (L51-L67)
If kubelet starts and calls `listConfig()` before kubeadm creates `/etc/kubernetes/manifests` (while writing the static pods manifests), the file watcher will be created less than a second after, but there will be no changes to report, so the manifests will only be detected on the next tick of `listTicker`, a bit less than 20s later7ad8303b96/pkg/kubelet/config/file.go (L102-L103)
Even if we fixed the watch code to `listConfig()` just after starting the inotify watch, watching source file is only supported on linux, so moving the manifests generation before kubelet start fixes all cases and make more sense IMO. Signed-off-by: Etienne Champetier <e.champetier@ateme.com>
This commit is contained in:
parent
53636bc780
commit
19ae2de19c
@ -134,9 +134,9 @@ func newCmdInit(out io.Writer, initOptions *initOptions) *cobra.Command {
|
|||||||
initRunner.AppendPhase(phases.NewPreflightPhase())
|
initRunner.AppendPhase(phases.NewPreflightPhase())
|
||||||
initRunner.AppendPhase(phases.NewCertsPhase())
|
initRunner.AppendPhase(phases.NewCertsPhase())
|
||||||
initRunner.AppendPhase(phases.NewKubeConfigPhase())
|
initRunner.AppendPhase(phases.NewKubeConfigPhase())
|
||||||
initRunner.AppendPhase(phases.NewKubeletStartPhase())
|
|
||||||
initRunner.AppendPhase(phases.NewControlPlanePhase())
|
|
||||||
initRunner.AppendPhase(phases.NewEtcdPhase())
|
initRunner.AppendPhase(phases.NewEtcdPhase())
|
||||||
|
initRunner.AppendPhase(phases.NewControlPlanePhase())
|
||||||
|
initRunner.AppendPhase(phases.NewKubeletStartPhase())
|
||||||
initRunner.AppendPhase(phases.NewWaitControlPlanePhase())
|
initRunner.AppendPhase(phases.NewWaitControlPlanePhase())
|
||||||
initRunner.AppendPhase(phases.NewUploadConfigPhase())
|
initRunner.AppendPhase(phases.NewUploadConfigPhase())
|
||||||
initRunner.AppendPhase(phases.NewUploadCertsPhase())
|
initRunner.AppendPhase(phases.NewUploadCertsPhase())
|
||||||
|
Loading…
Reference in New Issue
Block a user