Merge pull request #8804 from medyagh/hot_upgrade_fix
Stop kube-system containers before applying configuration updatespull/8818/head
commit
f230ca0c55
|
@ -554,6 +554,9 @@ func (k *Bootstrapper) restartControlPlane(cfg config.ClusterConfig) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
if err := k.stopKubeSystem(cfg); err != nil {
|
||||
glog.Warningf("Failed to stop kube-system containers: port conflicts may arise: %v", err)
|
||||
}
|
||||
if err := k.clearStaleConfigs(cfg); err != nil {
|
||||
return errors.Wrap(err, "clearing stale configs")
|
||||
}
|
||||
|
@ -905,6 +908,27 @@ func (k *Bootstrapper) elevateKubeSystemPrivileges(cfg config.ClusterConfig) err
|
|||
return nil
|
||||
}
|
||||
|
||||
// stopKubeSystem stops all the containers in the kube-system to prevent #8740 when doing hot upgrade
|
||||
func (k *Bootstrapper) stopKubeSystem(cfg config.ClusterConfig) error {
|
||||
glog.Info("stopping kube-system containers ...")
|
||||
cr, err := cruntime.New(cruntime.Config{Type: cfg.KubernetesConfig.ContainerRuntime, Runner: k.c})
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "new cruntime")
|
||||
}
|
||||
|
||||
ids, err := cr.ListContainers(cruntime.ListOptions{Namespaces: []string{"kube-system"}})
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "list")
|
||||
}
|
||||
|
||||
if len(ids) > 0 {
|
||||
if err := cr.StopContainers(ids); err != nil {
|
||||
return errors.Wrap(err, "stop")
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// adviseNodePressure will advise the user what to do with difference pressure errors based on their environment
|
||||
func adviseNodePressure(err error, name string, drv string) {
|
||||
if diskErr, ok := err.(*kverify.ErrDiskPressure); ok {
|
||||
|
|
Loading…
Reference in New Issue