cheliequan
2023-05-24 ab70148fc0213a4523d976099a18e438cb2ed067
src/util/util.go
@@ -100,7 +100,7 @@
func InstallDocker(nodeIP, sshUsername, sshPassword string, sshPort int) error {
   // 检查Docker是否已安装
   checkCommand := "which docker"
   _, err := sshExec(nodeIP, sshUsername, sshPassword, checkCommand, sshPort)
   _, err := SSHExec(nodeIP, sshUsername, sshPassword, checkCommand, sshPort)
   if err == nil {
      fmt.Println("Docker is already installed on the remote server.")
      return nil
@@ -108,7 +108,7 @@
   // 安装Docker
   installCommand := "sudo curl -fsSL https://get.docker.com -o get-docker.sh && sudo sh get-docker.sh"
   _, err = sshExec(nodeIP, sshUsername, sshPassword, installCommand, sshPort)
   _, err = SSHExec(nodeIP, sshUsername, sshPassword, installCommand, sshPort)
   if err != nil {
      return fmt.Errorf("failed to install Docker on the remote server: %v", err)
   }
@@ -129,7 +129,7 @@
func InstallKubectl(nodeIP, sshUsername, sshPassword string, sshPort int) error {
   // 检查kubectl是否已安装
   checkCommand := "which kubectl"
   _, err := sshExec(nodeIP, sshUsername, sshPassword, checkCommand, sshPort)
   _, err := SSHExec(nodeIP, sshUsername, sshPassword, checkCommand, sshPort)
   if err == nil {
      fmt.Println("kubectl is already installed on the remote server.")
      return nil
@@ -137,7 +137,7 @@
   // 安装kubectl
   installCommand := "sudo curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl && sudo chmod +x kubectl && sudo mv kubectl /usr/local/bin/"
   _, err = sshExec(nodeIP, sshUsername, sshPassword, installCommand, sshPort)
   _, err = SSHExec(nodeIP, sshUsername, sshPassword, installCommand, sshPort)
   if err != nil {
      return fmt.Errorf("failed to install kubectl on the remote server: %v", err)
   }