diff --git a/cmd/kubeadm/app/cmd/init.go b/cmd/kubeadm/app/cmd/init.go index 3c43404f603..5467b59956e 100644 --- a/cmd/kubeadm/app/cmd/init.go +++ b/cmd/kubeadm/app/cmd/init.go @@ -297,7 +297,7 @@ func (i *Init) Run(out io.Writer) error { // Try to stop the kubelet service so no race conditions occur when configuring it if !i.dryRun { glog.V(1).Infof("Stopping the kubelet") - preflight.TryStopKubelet(i.ignorePreflightErrors) + preflight.TryStopKubelet() } // Write env file with flags for the kubelet to use. We do not need to write the --register-with-taints for the master, @@ -315,7 +315,7 @@ func (i *Init) Run(out io.Writer) error { if !i.dryRun { // Try to start the kubelet service in case it's inactive glog.V(1).Infof("Starting the kubelet") - preflight.TryStartKubelet(i.ignorePreflightErrors) + preflight.TryStartKubelet() } // certsDirToWriteTo is gonna equal cfg.CertificatesDir in the normal case, but gonna be a temp directory if dryrunning diff --git a/cmd/kubeadm/app/cmd/join.go b/cmd/kubeadm/app/cmd/join.go index 4c1f32c180a..20ccfb4f048 100644 --- a/cmd/kubeadm/app/cmd/join.go +++ b/cmd/kubeadm/app/cmd/join.go @@ -281,7 +281,7 @@ func (j *Join) Run(out io.Writer) error { // Configure the kubelet. In this short timeframe, kubeadm is trying to stop/restart the kubelet // Try to stop the kubelet service so no race conditions occur when configuring it glog.V(1).Infof("Stopping the kubelet") - preflight.TryStopKubelet(j.ignorePreflightErrors) + preflight.TryStopKubelet() // Write the configuration for the kubelet (using the bootstrap token credentials) to disk so the kubelet can start if err := kubeletphase.DownloadConfig(bootstrapClient, kubeletVersion, kubeadmconstants.KubeletRunDirectory); err != nil { @@ -295,7 +295,7 @@ func (j *Join) Run(out io.Writer) error { // Try to start the kubelet service in case it's inactive glog.V(1).Infof("Starting the kubelet") - preflight.TryStartKubelet(j.ignorePreflightErrors) + preflight.TryStartKubelet() // Now the kubelet will perform the TLS Bootstrap, transforming /etc/kubernetes/bootstrap-kubelet.conf to /etc/kubernetes/kubelet.conf // Wait for the kubelet to create the /etc/kubernetes/kubelet.conf KubeConfig file. If this process diff --git a/cmd/kubeadm/app/preflight/checks.go b/cmd/kubeadm/app/preflight/checks.go index de9f29b40de..28d98e6ebbb 100644 --- a/cmd/kubeadm/app/preflight/checks.go +++ b/cmd/kubeadm/app/preflight/checks.go @@ -1053,10 +1053,7 @@ func RunChecks(checks []Checker, ww io.Writer, ignorePreflightErrors sets.String // TryStartKubelet attempts to bring up kubelet service // TODO: Move these kubelet start/stop functions to some other place, e.g. phases/kubelet -func TryStartKubelet(ignorePreflightErrors sets.String) { - if setHasItemOrAll(ignorePreflightErrors, "StartKubelet") { - return - } +func TryStartKubelet() { // If we notice that the kubelet service is inactive, try to start it initSystem, err := initsystem.GetInitSystem() if err != nil { @@ -1077,10 +1074,7 @@ func TryStartKubelet(ignorePreflightErrors sets.String) { } // TryStopKubelet attempts to bring down the kubelet service momentarily -func TryStopKubelet(ignorePreflightErrors sets.String) { - if setHasItemOrAll(ignorePreflightErrors, "StopKubelet") { - return - } +func TryStopKubelet() { // If we notice that the kubelet service is inactive, try to start it initSystem, err := initsystem.GetInitSystem() if err != nil {