mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-29 06:27:05 +00:00
kubeadm: Fix a bug where skipping all preflight checks wouldn't activate the kubelet
This commit is contained in:
parent
6d3f5b75f5
commit
d68eea584f
@ -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
|
// Try to stop the kubelet service so no race conditions occur when configuring it
|
||||||
if !i.dryRun {
|
if !i.dryRun {
|
||||||
glog.V(1).Infof("Stopping the kubelet")
|
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,
|
// 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 {
|
if !i.dryRun {
|
||||||
// Try to start the kubelet service in case it's inactive
|
// Try to start the kubelet service in case it's inactive
|
||||||
glog.V(1).Infof("Starting the kubelet")
|
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
|
// certsDirToWriteTo is gonna equal cfg.CertificatesDir in the normal case, but gonna be a temp directory if dryrunning
|
||||||
|
@ -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
|
// 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
|
// Try to stop the kubelet service so no race conditions occur when configuring it
|
||||||
glog.V(1).Infof("Stopping the kubelet")
|
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
|
// 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 {
|
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
|
// Try to start the kubelet service in case it's inactive
|
||||||
glog.V(1).Infof("Starting the kubelet")
|
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
|
// 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
|
// Wait for the kubelet to create the /etc/kubernetes/kubelet.conf KubeConfig file. If this process
|
||||||
|
@ -1053,10 +1053,7 @@ func RunChecks(checks []Checker, ww io.Writer, ignorePreflightErrors sets.String
|
|||||||
|
|
||||||
// TryStartKubelet attempts to bring up kubelet service
|
// TryStartKubelet attempts to bring up kubelet service
|
||||||
// TODO: Move these kubelet start/stop functions to some other place, e.g. phases/kubelet
|
// TODO: Move these kubelet start/stop functions to some other place, e.g. phases/kubelet
|
||||||
func TryStartKubelet(ignorePreflightErrors sets.String) {
|
func TryStartKubelet() {
|
||||||
if setHasItemOrAll(ignorePreflightErrors, "StartKubelet") {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
// If we notice that the kubelet service is inactive, try to start it
|
// If we notice that the kubelet service is inactive, try to start it
|
||||||
initSystem, err := initsystem.GetInitSystem()
|
initSystem, err := initsystem.GetInitSystem()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -1077,10 +1074,7 @@ func TryStartKubelet(ignorePreflightErrors sets.String) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TryStopKubelet attempts to bring down the kubelet service momentarily
|
// TryStopKubelet attempts to bring down the kubelet service momentarily
|
||||||
func TryStopKubelet(ignorePreflightErrors sets.String) {
|
func TryStopKubelet() {
|
||||||
if setHasItemOrAll(ignorePreflightErrors, "StopKubelet") {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
// If we notice that the kubelet service is inactive, try to start it
|
// If we notice that the kubelet service is inactive, try to start it
|
||||||
initSystem, err := initsystem.GetInitSystem()
|
initSystem, err := initsystem.GetInitSystem()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user