From 49ebcc87d304d66b6957a9760b5404b91474577b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20F=20Bj=C3=B6rklund?= Date: Sun, 19 Apr 2020 17:27:23 +0200 Subject: [PATCH 1/2] Enable docker and kubelet units after adding them This avoids warnings from `kubeadm init` later: [WARNING Service-Docker] [WARNING Service-Kubelet] --- pkg/minikube/bootstrapper/kubeadm/kubeadm.go | 1 + pkg/provision/provision.go | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/minikube/bootstrapper/kubeadm/kubeadm.go b/pkg/minikube/bootstrapper/kubeadm/kubeadm.go index 07f8dfb5c5..8adf48aabc 100644 --- a/pkg/minikube/bootstrapper/kubeadm/kubeadm.go +++ b/pkg/minikube/bootstrapper/kubeadm/kubeadm.go @@ -786,6 +786,7 @@ func startKubeletIfRequired(runner command.Runner, sm sysinit.Manager) error { return errors.Wrap(err, "starting kubelet") } + sm.Enable("kubelet") return sm.Start("kubelet") } diff --git a/pkg/provision/provision.go b/pkg/provision/provision.go index 1a388f24d1..de724ba014 100644 --- a/pkg/provision/provision.go +++ b/pkg/provision/provision.go @@ -292,7 +292,7 @@ func updateUnit(p provision.SSHCommander, name string, content string, dst strin if _, err := p.SSHCommand(fmt.Sprintf("sudo mkdir -p %s && printf %%s \"%s\" | sudo tee %s.new", path.Dir(dst), content, dst)); err != nil { return err } - if _, err := p.SSHCommand(fmt.Sprintf("sudo diff -u %s %s.new || { sudo mv %s.new %s; sudo systemctl -f daemon-reload && sudo sudo systemctl -f restart %s; }", dst, dst, dst, dst, name)); err != nil { + if _, err := p.SSHCommand(fmt.Sprintf("sudo diff -u %s %s.new || { sudo mv %s.new %s; sudo systemctl -f daemon-reload && sudo systemctl -f enable %s && sudo systemctl -f restart %s; }", dst, dst, dst, dst, name, name)); err != nil { return err } return nil From 863b27d260b5f3b8ec8672dbc7c0194ebcc76f02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20F=20Bj=C3=B6rklund?= Date: Mon, 20 Apr 2020 21:40:27 +0200 Subject: [PATCH 2/2] Return error from Enable if anything went wrong --- pkg/minikube/bootstrapper/kubeadm/kubeadm.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/minikube/bootstrapper/kubeadm/kubeadm.go b/pkg/minikube/bootstrapper/kubeadm/kubeadm.go index 8adf48aabc..27a7b28601 100644 --- a/pkg/minikube/bootstrapper/kubeadm/kubeadm.go +++ b/pkg/minikube/bootstrapper/kubeadm/kubeadm.go @@ -786,7 +786,9 @@ func startKubeletIfRequired(runner command.Runner, sm sysinit.Manager) error { return errors.Wrap(err, "starting kubelet") } - sm.Enable("kubelet") + if err := sm.Enable("kubelet"); err != nil { + return err + } return sm.Start("kubelet") }