From 2d699577bb40c915d127e5b5ee387f934453efa2 Mon Sep 17 00:00:00 2001 From: oldthreefeng Date: Tue, 16 Mar 2021 19:32:13 +0800 Subject: [PATCH] add prefight when version >= 1.20. Signed-off-by: oldthreefeng --- install/check.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/install/check.go b/install/check.go index bc172361408..396df8126ee 100644 --- a/install/check.go +++ b/install/check.go @@ -34,6 +34,7 @@ func (s *SealosInstaller) CheckValid() { os.Exit(1) } dict := make(map[string]bool) + var errList []string for _, h := range s.Hosts { hostname := SSHConfig.CmdToString(h, "hostname", "") //获取主机名 if hostname == "" { @@ -59,5 +60,24 @@ func (s *SealosInstaller) CheckValid() { os.Exit(1) } } + + // version >= 1.20 , Add prefight for containerd + if For120(Version) { + // for containerd. if docker exist ; exit frist. + + dockerExist := SSHConfig.CmdToString(h, "command -v dockerd &> /dev/null && echo yes || :", "") + if dockerExist == "yes" { + errList = append(errList, h) + } + } + } + + if len(errList) >= 1 { + logger.Error(`docker exist error when kubernetes version >= 1.20. +sealos install kubernetes version >= 1.20 use containerd cri instead. +please uninstall docker on [%s]. For example run on centos7: "yum remove docker-ce containerd-io -y", +see details: https://github.com/fanux/sealos/issues/582 + `, errList) + os.Exit(-1) } }