Add host alias back after restarting kubelet

pull/8035/head
Priya Wadhwa 2020-05-07 17:00:37 -07:00
parent fce75622cf
commit 9348667351
1 changed files with 7 additions and 0 deletions

View File

@ -205,6 +205,13 @@ func restartKubeletIfNeeded(starter Starter) error {
if err := sysinit.New(starter.Runner).Restart("kubelet"); err != nil {
return errors.Wrap(err, "restarting kubelet")
}
cp, err := config.PrimaryControlPlane(starter.Cfg)
if err != nil {
return errors.Wrap(err, "control plane")
}
if err := machine.AddHostAlias(starter.Runner, constants.ControlPlaneAlias, net.ParseIP(cp.IP)); err != nil {
return errors.Wrap(err, "adding host alias")
}
return nil
}