Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wait to add aliases to /etc/hosts before starting kubelet #8035

Merged
merged 19 commits into from
May 8, 2020
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion pkg/drivers/kic/kic.go
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,6 @@ func (d *Driver) Restart() error {
return fmt.Errorf("start during restart %v", err)
}
return nil

}

// Start an already created kic container
Expand Down
22 changes: 22 additions & 0 deletions pkg/minikube/node/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ import (
"k8s.io/minikube/pkg/minikube/mustload"
"k8s.io/minikube/pkg/minikube/out"
"k8s.io/minikube/pkg/minikube/proxy"
"k8s.io/minikube/pkg/minikube/sysinit"
"k8s.io/minikube/pkg/util"
"k8s.io/minikube/pkg/util/retry"
)
Expand Down Expand Up @@ -180,12 +181,33 @@ func Start(starter Starter, apiServer bool) (*kubeconfig.Settings, error) {
}
}

if err := restartKubeletIfNeeded(starter); err != nil {
return nil, errors.Wrap(err, "restarting kubelet")
priyawadhwa marked this conversation as resolved.
Show resolved Hide resolved
}

wg.Wait()

// Write enabled addons to the config before completion
return kcs, config.Write(viper.GetString(config.ProfileName), starter.Cfg)
}

func restartKubeletIfNeeded(starter Starter) error {
if !starter.PreExists {
return nil
}
if !driver.IsKIC(starter.Host.DriverName) {
priyawadhwa marked this conversation as resolved.
Show resolved Hide resolved
return nil
}
// on soft start and kic, we need to restart kubelet to ensure that it picks up the correct node ip
priyawadhwa marked this conversation as resolved.
Show resolved Hide resolved
// there seems to be a race condition between when the ip is updated
// on node restarts and kubelet starting up
glog.Infof("Restarting kubelet...")
if err := sysinit.New(starter.Runner).Restart("kubelet"); err != nil {
return errors.Wrap(err, "restarting kubelet")
}
return nil
}

// Provision provisions the machine/container for the node
func Provision(cc *config.ClusterConfig, n *config.Node, apiServer bool) (command.Runner, bool, libmachine.API, *host.Host, error) {

Expand Down
3 changes: 3 additions & 0 deletions test/integration/start_stop_delete_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ func TestStartStop(t *testing.T) {
"--disable-driver-mounts",
"--extra-config=kubeadm.ignore-preflight-errors=SystemVerification",
}},
{"docker", constants.DefaultKubernetesVersion, []string{
priyawadhwa marked this conversation as resolved.
Show resolved Hide resolved
"--container-runtime=docker",
}},
{"embed-certs", constants.DefaultKubernetesVersion, []string{
"--embed-certs",
}},
Expand Down