Restart kubelet in a function that is called on soft start
parent
a353d564dd
commit
163ab88408
|
|
@ -294,16 +294,7 @@ func (d *Driver) Restart() error {
|
|||
if err = d.Start(); err != nil {
|
||||
return fmt.Errorf("start during restart %v", err)
|
||||
}
|
||||
// we need to restart kubelet to ensure that it picks up the correct node ip
|
||||
// there seems to be a race condition between when the ip is updated
|
||||
// on node restarts and kubelet starting up
|
||||
glog.Infof("Restarting kubelet...")
|
||||
cr := command.NewExecRunner() // using exec runner for interacting with docker/podman daemon
|
||||
if _, err := cr.RunCmd(exec.Command("sudo", "systemctl", "restart", "kubelet")); err != nil {
|
||||
return errors.Wrap(err, "restarting kubelet")
|
||||
}
|
||||
return nil
|
||||
|
||||
}
|
||||
|
||||
// Start an already created kic container
|
||||
|
|
|
|||
|
|
@ -812,8 +812,11 @@ func startKubeletIfRequired(runner command.Runner, sm sysinit.Manager) error {
|
|||
|
||||
checkCmd := exec.Command("/bin/bash", "-c", fmt.Sprintf("pgrep kubelet && diff -u %s %s.new && diff -u %s %s.new", svc, svc, conf, conf))
|
||||
if _, err := runner.RunCmd(checkCmd); err == nil {
|
||||
glog.Infof("kubelet is already running with the right configs")
|
||||
return nil
|
||||
// we need to restart kubelet to ensure that it picks up the correct node ip
|
||||
// there seems to be a race condition between when the ip is updated
|
||||
// on node restarts and kubelet starting up
|
||||
glog.Infof("Restarting kubelet...")
|
||||
return sysinit.New(runner).Restart("kubelet")
|
||||
}
|
||||
|
||||
startCmd := exec.Command("/bin/bash", "-c", fmt.Sprintf("sudo cp %s.new %s && sudo cp %s.new %s", svc, svc, conf, conf))
|
||||
|
|
|
|||
Loading…
Reference in New Issue