diff --git a/data/config/language.txt b/data/config/language.txt index 2c4c454..99fd52c 100644 --- a/data/config/language.txt +++ b/data/config/language.txt @@ -1 +1 @@ -en \ No newline at end of file +cn \ No newline at end of file diff --git a/data/config/tools.txt b/data/config/tools.txt new file mode 100644 index 0000000..969966c --- /dev/null +++ b/data/config/tools.txt @@ -0,0 +1 @@ +on,on,on \ No newline at end of file diff --git a/data/msg/msg.txt b/data/msg/msg.txt index 6fb66a5..12a6f48 100644 --- a/data/msg/msg.txt +++ b/data/msg/msg.txt @@ -4,3 +4,5 @@ + + diff --git a/data/statistics/cpuinfo.txt b/data/statistics/cpuinfo.txt index 56a6051..c227083 100644 --- a/data/statistics/cpuinfo.txt +++ b/data/statistics/cpuinfo.txt @@ -1 +1 @@ -1 \ No newline at end of file +0 \ No newline at end of file diff --git a/data/statistics/diskinfo.txt b/data/statistics/diskinfo.txt index b393560..c24b6ae 100644 --- a/data/statistics/diskinfo.txt +++ b/data/statistics/diskinfo.txt @@ -1 +1 @@ -23 \ No newline at end of file +38 \ No newline at end of file diff --git a/data/statistics/k8snum.txt b/data/statistics/k8snum.txt index c227083..56a6051 100644 --- a/data/statistics/k8snum.txt +++ b/data/statistics/k8snum.txt @@ -1 +1 @@ -0 \ No newline at end of file +1 \ No newline at end of file diff --git a/data/statistics/labellist.txt b/data/statistics/labellist.txt index ffb9121..833ea6e 100644 --- a/data/statistics/labellist.txt +++ b/data/statistics/labellist.txt @@ -1 +1 @@ -,,,, \ No newline at end of file +,,,,k8s-test-001 \ No newline at end of file diff --git a/data/statistics/meminfo.txt b/data/statistics/meminfo.txt index bf0d87a..62f9457 100644 --- a/data/statistics/meminfo.txt +++ b/data/statistics/meminfo.txt @@ -1 +1 @@ -4 \ No newline at end of file +6 \ No newline at end of file diff --git a/data/statistics/nodenumlist.txt b/data/statistics/nodenumlist.txt index ffb9121..8e3bb0e 100644 --- a/data/statistics/nodenumlist.txt +++ b/data/statistics/nodenumlist.txt @@ -1 +1 @@ -,,,, \ No newline at end of file +,,,,3 \ No newline at end of file diff --git a/data/statistics/stuok.txt b/data/statistics/stuok.txt index 9efc394..af84432 100644 --- a/data/statistics/stuok.txt +++ b/data/statistics/stuok.txt @@ -1 +1 @@ -0E+00 \ No newline at end of file +1E+02 \ No newline at end of file diff --git a/data/statistics/stuunkonw.txt b/data/statistics/stuunkonw.txt index af84432..9efc394 100644 --- a/data/statistics/stuunkonw.txt +++ b/data/statistics/stuunkonw.txt @@ -1 +1 @@ -1E+02 \ No newline at end of file +0E+00 \ No newline at end of file diff --git a/docs/images/loginkey.jpg b/docs/images/loginkey.jpg index 00d267a..d905136 100644 Binary files a/docs/images/loginkey.jpg and b/docs/images/loginkey.jpg differ diff --git a/docs/images/loginkey2.jpg b/docs/images/loginkey2.jpg index 00d267a..d905136 100644 Binary files a/docs/images/loginkey2.jpg and b/docs/images/loginkey2.jpg differ diff --git a/kube-install.go b/kube-install.go index 37a0b2e..e70c133 100644 --- a/kube-install.go +++ b/kube-install.go @@ -14,16 +14,7 @@ import ( func main() { - var exec string - var master string - var node string - var k8sver string - var ostype string - var softdir string - var label string - var sship string - var sshpass string - var listen string + var exec,master,node,k8sver,ostype,softdir,label,sship,sshpass,listen,upgradekernel string initFlag := flag.Bool("init",false,"Initialize the local system environment.") iFlag := flag.Bool("i",false,"Initialize the local system environment.") @@ -42,8 +33,9 @@ func main() { flag.StringVar(&node,"node","","The IP address of k8s node server filled in for the first installation") flag.StringVar(&ostype,"ostype","","Specifies the distribution operating system type: centos7 | centos8 | rhel7 | rhel8 | ubuntu20 | suse15") flag.StringVar(&k8sver,"k8sver","","Specifies the version of k8s software installed.(Default is \"kubernetes 1.22\")") + flag.StringVar(&upgradekernel,"upgradekernel","no","Because the lower versions of CentOS 7 and redhat 7 may lack kernel modules, only the kernel automatic upgrade of CentOS 7 and rhel7 operating systems is supported here, and other operating systems do not need to be upgraded. (Default is \"no\")") flag.StringVar(&softdir,"softdir","","Specifies the installation directory of kubernetes cluster.(Default is \"/exec/kube-install\")") - flag.StringVar(&label,"label",".default","In the case of deploying and operating multiple kubernetes clusters, it is necessary to specify a label to uniquely identify a kubernetes cluster.") + flag.StringVar(&label,"label",".default","In the case of deploying and operating multiple kubernetes clusters, it is necessary to specify a label to uniquely identify a kubernetes cluster. (Length must be less than 32 strings)") flag.StringVar(&sship,"sship","","The IP address of the target host through which the SSH channel is opened.(Use with \"sshcontrol\")") flag.StringVar(&sshpass,"sshpass","","The SSH password of the target host through which the SSH channel is opened.(Use with \"sshcontrol\")") flag.Parse() @@ -58,8 +50,8 @@ func main() { // Set the version number and release date of Kube-Install. const ( - Version string = "v0.7.2" - ReleaseDate string = "10/22/2021" + Version string = "v0.7.3" + ReleaseDate string = "12/8/2021" CompatibleK8S string = "1.17, 1.18, 1.19, 1.20, 1.21, 1.22, and 1.23" CompatibleOS string = "CentOS linux 7, CentOS linux 8, RHEL 7, RHEL 8, Ubuntu 20, and SUSE 15" ) @@ -72,6 +64,7 @@ func main() { fmt.Println("\nInitialization in progress, please wait...\n") kilib.CreateDir(currentDir+"/data/config", currentDir, logName, "") kilib.CreateFile(currentDir+"/data/config/language.txt", currentDir, logName, "") + kilib.CreateFile(currentDir+"/data/config/tools.txt", currentDir, logName, "") kilib.CreateDir(currentDir+"/data/output", currentDir, logName, "") kilib.CreateDir(currentDir+"/data/logs", currentDir, logName, "") kilib.CreateDir(currentDir+"/data/msg", currentDir, logName, "") @@ -119,22 +112,24 @@ func main() { case *showk8sFlag , *sFlag : labelArray,err := kilib.GetAllDir(currentDir+"/data/output",currentDir,logName,"") kilib.CheckErr(err,currentDir,logName,"") - fmt.Println("---------------------------┬-----------┬---------------------┬-----------------------------------┬-------------------------------\n Label Of K8S Cluster | Version | Installation Status | Resource File Directory | K8S-Master Information \n---------------------------┼-----------┼---------------------┼-----------------------------------┼-------------------------------") + fmt.Println("---------------------------------┬-----------┬----------------┬-------------------------------------┬---------------------------------\n Kubernetes Cluster Label | Version | Install Status | Install Resource Directory | Kubernetes Master Information \n---------------------------------┼-----------┼----------------┼-------------------------------------┼---------------------------------") for _, i := range labelArray { - label1 := " | " - k8sver1 := " | " - status1 := " | " - softDir1 := " |" - label2 := string(i) - k8sver2 := "k8s "+kilib.GetClusterK8sVer(label2,currentDir,"") - status2,_ := kilib.GetClusterStatus(label2,currentDir,logName,"") - softDir2 := kilib.GetClusterSoftdir(label2,currentDir,"") - if len(softDir2) < len(softDir1) { softDir2 = softDir2 + softDir1[len(softDir2):len(softDir1)] } - master2 := kilib.GetClusterMaster(label2,currentDir,logName,"") - fmt.Printf(" " + label2 + label1[len(label2):len(label1)] + k8sver2 + k8sver1[len(k8sver2):len(k8sver1)] + status2 + status1[len(status2):len(status1)] + softDir2+" ") - fmt.Println(master2) + var label2,softDir2 string + labelInit := " | " + k8sverInit := " | " + statusInit := " | " + softDirInit := " |" + label := string(i) + if len(label) < len(labelInit) { label2 = label + labelInit[len(label):len(labelInit)] } else { label2 = label + " | " } + k8sver := "k8s "+kilib.GetClusterK8sVer(label,currentDir,"") + status,_ := kilib.GetClusterStatus(label,currentDir,logName,"") + softDir := kilib.GetClusterSoftdir(label,currentDir,"") + if len(softDir) < len(softDirInit) { softDir2 = softDir + softDirInit[len(softDir):len(softDirInit)] } else { softDir2 = softDir + " |" } + master := kilib.GetClusterMaster(label,currentDir,logName,"") + fmt.Printf(" " + label2 + k8sver + k8sverInit[len(k8sver):len(k8sverInit)] + status + statusInit[len(status):len(statusInit)] + softDir2+" ") + fmt.Println(master) } - fmt.Println("---------------------------┴-----------┴---------------------┴-----------------------------------┴-------------------------------") + fmt.Println("---------------------------------┴-----------┴----------------┴-------------------------------------┴---------------------------------") // View software version details. case *versionFlag , *vFlag : @@ -163,15 +158,18 @@ func main() { case exec == "install" : kilib.CheckParam(exec,"master",master) kilib.CheckParam(exec,"node",node) + if !kilib.CheckLabel(label) { + panic("\nThe \"-ostype\" parameter length must be less than 32 strings, please check! \n\n ") + } masterArray,nodeArray,softdir,subProcessDir,ostypeResult := kilib.ParameterConvert("", master, node, softdir, label, ostype) kilib.DatabaseInit(currentDir,subProcessDir,logName,"") - kilib.InstallCore("",master,masterArray,node,nodeArray,softdir,currentDir,kissh,subProcessDir,currentUser,label,ostypeResult,ostype,k8sver,logName,Version,CompatibleK8S,CompatibleOS,"","newinstall") + kilib.InstallCore("",master,masterArray,node,nodeArray,softdir,currentDir,kissh,subProcessDir,currentUser,label,ostypeResult,ostype,k8sver,logName,Version,CompatibleK8S,CompatibleOS,"","newinstall",upgradekernel) //Execute addnode command case exec == "addnode" : kilib.CheckParam(exec,"node",node) _,nodeArray,_,subProcessDir,ostypeResult := kilib.ParameterConvert("", "", node, softdir, label, ostype) - kilib.AddNodeCore("",node,nodeArray,currentDir,kissh,subProcessDir,currentUser,label,softdir,ostypeResult,logName,CompatibleOS) + kilib.AddNodeCore("",node,nodeArray,currentDir,kissh,subProcessDir,currentUser,label,softdir,ostypeResult,logName,CompatibleOS,upgradekernel) //Execute delnode command case exec == "delnode" : diff --git a/kube-install.service b/kube-install.service index 8095c05..d9fad70 100644 --- a/kube-install.service +++ b/kube-install.service @@ -1,5 +1,5 @@ [Unit] -Description=The highly available multiple kubernetes cluster can be installed offline with one click. +Description=The highly available multiple kubernetes cluster can be installed offline with one click. Documentation=https://cloudnativer.github.io After=sshd.service Requires=sshd.service diff --git a/lib/check.go b/lib/check.go index 28c31c1..bfb5530 100644 --- a/lib/check.go +++ b/lib/check.go @@ -69,6 +69,15 @@ func CheckPort(port int) bool { } } +// Check whether the cluster label is correct. +func CheckLabel(label string) bool { + if len(label) > 32 { + return false + } else { + return true + } +} + // Check whether the parameters are input normally. func CheckParam(option string, paramName string, param string) { if param == "" { diff --git a/lib/common.go b/lib/common.go index 7d6ef17..8e42597 100644 --- a/lib/common.go +++ b/lib/common.go @@ -203,4 +203,3 @@ func LogStr(mode string) string { } return logStr } - diff --git a/lib/core.go b/lib/core.go index 3f90c09..ff4f34c 100644 --- a/lib/core.go +++ b/lib/core.go @@ -103,9 +103,17 @@ func DeleteMasterCore(mode string, masterArray []string, currentDir string, kiss } // Add the core operation part of the node. -func AddNodeCore(mode string, node string, nodeArray []string, currentDir string, kissh string, subProcessDir string, currentUser string, label string, softDir string, osTypeResult string, logName string, CompatibleOS string) { +func AddNodeCore(mode string, node string, nodeArray []string, currentDir string, kissh string, subProcessDir string, currentUser string, label string, softDir string, osTypeResult string, logName string, CompatibleOS string, upgradeKernel string) { opt := "addnode" logStr := LogStr(mode) + upgradeKernelStr := "\n Automatically Upgrade OS Kernel: Not Support" + if osTypeResult == "centos7" || osTypeResult == "rhel7" { + if upgradeKernel == "yes"{ + upgradeKernelStr = "\n Automatically Upgrade OS Kernel: YES" + } else { + upgradeKernelStr = "\n Automatically Upgrade OS Kernel: NO" + } + } CheckOS(CompatibleOS, osTypeResult, currentDir, logName, mode) CreateDir(currentDir+"/data/output"+subProcessDir, currentDir, logName, mode) for i := 0; i < len(nodeArray); i++ { @@ -116,7 +124,7 @@ func AddNodeCore(mode string, node string, nodeArray []string, currentDir string } os.OpenFile(currentDir+"/data/logs"+subProcessDir+"/logs/addnode.log", os.O_RDWR|os.O_TRUNC|os.O_CREATE, 0766) ShellExecute("echo \"*************************************************************************************\n\n[Info] "+time.Now().String()+" Adding kubernetes node, please wait ... \n\""+logStr+currentDir+"/data/logs"+subProcessDir+"/logs/addnode.log") - ShellExecute("echo \" Kubernetes Cluster Label: "+label+"\n Kubernetes Node: "+node+"\n System User for Operation: "+currentUser+"\""+logStr+currentDir+"/data/logs"+subProcessDir+"/logs/addnode.log") + ShellExecute("echo \" Kubernetes Cluster Label: "+label+"\n Kubernetes Node: "+node+ upgradeKernelStr +"\n System User for Operation: "+currentUser+"\""+logStr+currentDir+"/data/logs"+subProcessDir+"/logs/addnode.log") ShellExecute("sed -i '1d' "+currentDir+"/data/msg/msg.txt") ShellExecute("echo \"
[Info] "+time.Now().String()+" Adding kubernetes node to "+label+" cluster ...
\" >> "+currentDir+"/data/msg/msg.txt") if !AddnodeConfig(mode, nodeArray, currentDir, subProcessDir, logName) { @@ -126,7 +134,7 @@ func AddNodeCore(mode string, node string, nodeArray []string, currentDir string ShellExecute("echo [Error] "+time.Now().String()+" \"The parameters you entered are incorrect, please check! \n\""+logStr+currentDir+"/data/logs"+subProcessDir+"/logs/addnode.log") return } - AddnodeYML("",currentDir+"/data/output"+subProcessDir,currentDir,currentUser,osTypeResult,logName) + AddnodeYML("",currentDir+"/data/output"+subProcessDir,currentDir,currentUser,logName,upgradeKernel,osTypeResult) err_addnode := ExecuteOpt(kissh, currentDir, opt, opt, subProcessDir, "") if err_addnode != nil { for i := 0; i < len(nodeArray); i++ { @@ -202,10 +210,18 @@ func DeleteNodeCore(mode string, nodeArray []string, currentDir string, kissh st } // Install the core operation part of the cluster. -func InstallCore(mode string, master string, masterArray []string, node string, nodeArray []string, softDir string, currentDir string, kissh string, subProcessDir string, currentUser string, label string, osTypeResult string, osType string, k8sVer string, logName string, Version string, CompatibleK8S string, CompatibleOS string, installTime string, way string) { +func InstallCore(mode string, master string, masterArray []string, node string, nodeArray []string, softDir string, currentDir string, kissh string, subProcessDir string, currentUser string, label string, osTypeResult string, osType string, k8sVer string, logName string, Version string, CompatibleK8S string, CompatibleOS string, installTime string, way string, upgradeKernel string) { opt := "install" layoutName := "install" logStr := LogStr(mode) + upgradeKernelStr := "\n Automatically Upgrade OS Kernel: Not Support" + if osTypeResult == "centos7" || osTypeResult == "rhel7" { + if upgradeKernel == "yes"{ + upgradeKernelStr = "\n Automatically Upgrade OS Kernel: YES" + } else { + upgradeKernelStr = "\n Automatically Upgrade OS Kernel: NO" + } + } CheckOS(CompatibleOS, osTypeResult, currentDir, logName, mode) CheckK8sVersion(Version, CompatibleK8S, k8sVer, currentDir, logName, mode) CreateDir(currentDir+"/data/output"+subProcessDir, currentDir, logName, mode) @@ -238,14 +254,14 @@ func InstallCore(mode string, master string, masterArray []string, node string, InstallIpvsYaml(mode, currentDir, masterArray, subProcessDir, logName) var err_install error if len(masterArray) == 1{ - OnemasterInstallYML(mode,currentDir+"/data/output"+subProcessDir,currentDir,currentUser,osTypeResult,logName) + OnemasterInstallYML(mode,currentDir+"/data/output"+subProcessDir,currentDir,currentUser,logName, upgradeKernel,osTypeResult) layoutName = "onemasterinstall" }else{ - InstallYML(mode,currentDir+"/data/output"+subProcessDir, currentDir, currentUser, osTypeResult, logName) + InstallYML(mode,currentDir+"/data/output"+subProcessDir, currentDir, currentUser, logName, upgradeKernel,osTypeResult) } if installTime != "" { ShellExecute("echo \"*************************************************************************************\n\n[Info] "+time.Now().String()+" Start scheduled installation task, please wait ... \n\""+logStr+currentDir+"/data/logs"+subProcessDir+"/logs/install.log") - ShellExecute("echo \" Kubernetes Cluster Label: "+label+"\n Kubernetes Version: Kubernetes v"+k8sVer+"\n Kubernetes Master: "+master+"\n Kubernetes Node: "+node+"\n Operating System Type: "+osType+"\n System User for Installation: "+currentUser+"\""+logStr+currentDir+"/data/logs"+subProcessDir+"/logs/install.log") + ShellExecute("echo \" Kubernetes Cluster Label: "+label+"\n Kubernetes Version: Kubernetes v"+k8sVer+"\n Kubernetes Master: "+master+"\n Kubernetes Node: "+node+"\n Operating System Type: "+osType+ upgradeKernelStr +"\n System User for Installation: "+currentUser+"\""+logStr+currentDir+"/data/logs"+subProcessDir+"/logs/install.log") DatabaseUpdate(currentDir+"/data/output"+subProcessDir+"/softdirtemp.txt", softDir, currentDir, logName, mode) DatabaseUpdate(currentDir+"/data/output"+subProcessDir+"/ostypetemp.txt", osType, currentDir, logName, mode) DatabaseUpdate(currentDir+"/data/output"+subProcessDir+"/k8svertemp.txt", k8sVer, currentDir, logName, mode) @@ -254,7 +270,7 @@ func InstallCore(mode string, master string, masterArray []string, node string, return } else { ShellExecute("echo \"*************************************************************************************\n\n[Info] "+time.Now().String()+" Installing kubernetes cluster, please wait ... \n\""+logStr+currentDir+"/data/logs"+subProcessDir+"/logs/install.log") - ShellExecute("echo \" Kubernetes Cluster Label: "+label+"\n Kubernetes Version: Kubernetes v"+k8sVer+"\n Kubernetes Master: "+master+"\n Kubernetes Node: "+node+"\n Operating System Type: "+osType+"\n System User for Installation: "+currentUser+"\""+logStr+currentDir+"/data/logs"+subProcessDir+"/logs/install.log") + ShellExecute("echo \" Kubernetes Cluster Label: "+label+"\n Kubernetes Version: Kubernetes v"+k8sVer+"\n Kubernetes Master: "+master+"\n Kubernetes Node: "+node+"\n Operating System Type: "+osType+ upgradeKernelStr +"\n System User for Installation: "+currentUser+"\""+logStr+currentDir+"/data/logs"+subProcessDir+"/logs/install.log") sch,_ := ReadFile(currentDir+"/data/output"+subProcessDir+"/scheduler.txt") if sch == "on" { ShellExecute("echo [Error] "+time.Now().String()+" \"Installation conflict! Background scheduled tasks exist and installation is in progress.\n\""+logStr+currentDir+"/data/logs"+subProcessDir+"/logs/install.log") diff --git a/lib/daemon.go b/lib/daemon.go index b321f12..b2967d5 100644 --- a/lib/daemon.go +++ b/lib/daemon.go @@ -1,7 +1,8 @@ package kilib import ( - // "fmt" +// "fmt" + "html/template" "io" "net/http" @@ -41,14 +42,15 @@ type ClusterList struct { } type ClusterAddForm struct { - Master string `form:"master" binding:"required"` - Node string `form:"node" binding:"required"` - Ostype string `form:"ostype" binding:"required"` - K8sver string `form:"k8sver" binding:"required"` - Label string `form:"label" binding:"required"` - Softdir string `form:"softdir"` - Installtime string `form:"installtime"` - Way string `form:"way"` + Master string `form:"master" binding:"required"` + Node string `form:"node" binding:"required"` + Ostype string `form:"ostype" binding:"required"` + K8sver string `form:"k8sver" binding:"required"` + Label string `form:"label" binding:"required"` + Softdir string `form:"softdir"` + Installtime string `form:"installtime"` + Way string `form:"way"` + Upgradekernel string `form:"upgradekernel"` } type ClusterDelForm struct { @@ -104,11 +106,12 @@ type NodeList struct { } type NodeAddForm struct { - Node string `form:"addnode" binding:"required"` - Label string `form:"label" binding:"required"` - K8sver string `form:"k8sver" binding:"required"` - Softdir string `form:"softdir" binding:"required"` - Ostype string `form:"ostype" binding:"required"` + Node string `form:"addnode" binding:"required"` + Label string `form:"label" binding:"required"` + K8sver string `form:"k8sver" binding:"required"` + Softdir string `form:"softdir" binding:"required"` + Ostype string `form:"ostype" binding:"required"` + Upgradekernel string `form:"upgradekernel"` } type NodeDelForm struct { @@ -129,6 +132,12 @@ type SelectList struct { Status string `json:"status"` } +type ToolSwitchForm struct { + Sshtool string `form:"sshtool" binding:"required"` + Installtool string `form:"installtool" binding:"required"` + Calendartool string `form:"calendartool" binding:"required"` +} + type SshKeyForm struct { Sship string `form:"sship" binding:"required"` Sshpass string `form:"sshpass" binding:"required"` @@ -613,6 +622,10 @@ func DaemonRun(Version string, ReleaseDate string, CompatibleK8S string, Compati router.GET("/tools", func(c *gin.Context) { langFromWeb := c.Query("lang") Lang := ChangeLang(langFromWeb, currentDir, logName, mode) + toolSwitch := GetToolSwitch(currentDir, logName, mode) + sshTool := toolSwitch[0] + installTool := toolSwitch[1] + calendarTool := toolSwitch[2] label := c.DefaultQuery("label", "") k8sVer := c.DefaultQuery("k8sver", "") softDir := c.DefaultQuery("softdir", "/opt/kube-install") @@ -620,6 +633,9 @@ func DaemonRun(Version string, ReleaseDate string, CompatibleK8S string, Compati c.HTML(http.StatusOK, "tools.tmpl", gin.H{ "Lang": Lang, "Label": label, + "Sshtool": sshTool, + "Installtool": installTool, + "Calendartool": calendarTool, "K8sver": k8sVer, "Softdir": softDir, "Ostype": osType, @@ -725,7 +741,7 @@ func DaemonRun(Version string, ReleaseDate string, CompatibleK8S string, Compati // operation of install router.POST("/install", func(c *gin.Context) { var form ClusterAddForm - var master, node, osType, k8sVer, softDir, label, installTime, way string + var master, node, osType, k8sVer, softDir, label, installTime, way, upgradeKernel string if c.ShouldBind(&form) == nil { master = form.Master node = form.Node @@ -735,6 +751,7 @@ func DaemonRun(Version string, ReleaseDate string, CompatibleK8S string, Compati label = form.Label installTime = form.Installtime way = form.Way + upgradeKernel = form.Upgradekernel } else { master = c.Query("master") node = c.Query("node") @@ -744,10 +761,15 @@ func DaemonRun(Version string, ReleaseDate string, CompatibleK8S string, Compati label = c.DefaultQuery("label", "") installTime = c.DefaultQuery("installtime", "") way = c.DefaultQuery("way", "newinstall") + upgradeKernel = c.DefaultQuery("upgradekernel", "") } - langFromWeb := c.Query("lang") - Lang := ChangeLang(langFromWeb, currentDir, logName, mode) - tools := c.Query("tools") + langFromWeb := c.Query("lang") + Lang := ChangeLang(langFromWeb, currentDir, logName, mode) + tools := c.Query("tools") + if !CheckLabel(label) { + c.HTML(http.StatusOK, "optresult.tmpl", gin.H{"Label": label, "K8sver": k8sVer, "Opt": "install", "Result": "failure", "Info": "Installation failed! The \"label\" parameter length must be less than 32 strings, please check!", "Softdir": softDir, "Ostype": osType, "Tools": tools, "Lang": Lang, "Version": Version, "Releasedate": ReleaseDate, "Compatiblek8s": CompatibleK8S, "Compatibleos": CompatibleOS}) + return + } if osType == "unknow" { c.HTML(http.StatusOK, "optresult.tmpl", gin.H{"Label": label, "K8sver": k8sVer, "Opt": "install", "Result": "failure", "Info": "Installation failed! Please set the operating system type correctly!", "Softdir": softDir, "Ostype": osType, "Tools": tools, "Lang": Lang, "Version": Version, "Releasedate": ReleaseDate, "Compatiblek8s": CompatibleK8S, "Compatibleos": CompatibleOS}) return @@ -778,7 +800,7 @@ func DaemonRun(Version string, ReleaseDate string, CompatibleK8S string, Compati stu, sch := GetClusterStatus(label, currentDir, logName, mode) var installInfo string if stu != "installing" && stu != "restarting" && stu != "uninstalling" && sch != "on" { - go InstallCore(mode, master, masterArray, node, nodeArray, softDir, currentDir, kissh, subProcessDir, currentUser, label, osTypeResult, osType, k8sVer, logName, Version, CompatibleK8S, CompatibleOS, installTime, way) + go InstallCore(mode, master, masterArray, node, nodeArray, softDir, currentDir, kissh, subProcessDir, currentUser, label, osTypeResult, osType, k8sVer, logName, Version, CompatibleK8S, CompatibleOS, installTime, way, upgradeKernel ) if installTime == "" { if Lang == "cn" { installInfo = "Kubernetes集群正在后台安装中 ... " @@ -900,19 +922,21 @@ func DaemonRun(Version string, ReleaseDate string, CompatibleK8S string, Compati // operation of add node router.POST("/addnode", func(c *gin.Context) { var form NodeAddForm - var node, softDir, label, k8sVer, osType string + var node, softDir, label, k8sVer, osType, upgradeKernel string if c.ShouldBind(&form) == nil { node = form.Node softDir = form.Softdir label = form.Label k8sVer = form.K8sver osType = form.Ostype + upgradeKernel = form.Upgradekernel } else { node = c.Query("node") softDir = c.DefaultQuery("softdir", "/opt/kube-install") label = c.DefaultQuery("label", "") k8sVer = c.DefaultQuery("k8sver", "") osType = c.DefaultQuery("ostype", "") + upgradeKernel = c.DefaultQuery("upgradekernel", "") } langFromWeb := c.Query("lang") Lang := ChangeLang(langFromWeb, currentDir, logName, mode) @@ -945,7 +969,7 @@ func DaemonRun(Version string, ReleaseDate string, CompatibleK8S string, Compati } } } - go AddNodeCore(mode, node, nodeArray, currentDir, kissh, subProcessDir, currentUser, label, softDir, osTypeResult, logName, CompatibleOS) + go AddNodeCore(mode, node, nodeArray, currentDir, kissh, subProcessDir, currentUser, label, softDir, osTypeResult, logName, CompatibleOS, upgradeKernel ) if Lang == "cn" { c.HTML(http.StatusOK, "optresult.tmpl", gin.H{"Label": label, "K8sver": k8sVer, "Opt": "addnode", "Result": "success", "Info": "Kubernetes node正在后台添加中 ...", "Softdir": softDir, "Ostype": osType, "Tools": "no", "Lang": Lang, "Version": Version, "Releasedate": ReleaseDate, "Compatiblek8s": CompatibleK8S, "Compatibleos": CompatibleOS}) } else { @@ -1082,6 +1106,44 @@ func DaemonRun(Version string, ReleaseDate string, CompatibleK8S string, Compati c.HTML(http.StatusOK, "optresult.tmpl", gin.H{"Label": label, "K8sver": k8sVer, "Opt": "deleteschedule", "Result": scheduleResult, "Info": scheduleInfo, "Softdir": softDir, "Ostype": osType, "Tools": tools, "Lang": Lang, "Version": Version, "Releasedate": ReleaseDate, "Compatiblek8s": CompatibleK8S, "Compatibleos": CompatibleOS}) }) + // Set tools switch + router.POST("/toolswitch", func(c *gin.Context) { + var form ToolSwitchForm + var sshTool, installTool, calendarTool string + tools := c.Query("tools") + label := c.DefaultQuery("label", "") + k8sVer := c.DefaultQuery("k8sver", "") + softDir := c.DefaultQuery("softdir", "/opt/kube-install") + osType := c.DefaultQuery("ostype", "") + langFromWeb := c.Query("lang") + Lang := ChangeLang(langFromWeb, currentDir, logName, mode) + if c.ShouldBind(&form) == nil { + sshTool = form.Sshtool + installTool = form.Installtool + calendarTool = form.Calendartool + err := SetToolSwitch(sshTool, installTool, calendarTool, currentDir, logName, mode) + if err != nil { + if Lang == "cn" { + c.HTML(http.StatusOK, "optresult.tmpl", gin.H{"Label": label, "K8sver": k8sVer, "Opt": "toolswitch", "Result": "failure", "Info": "工具面板设置操作失败!", "Softdir": softDir, "Ostype": osType, "Tools": tools, "Lang": Lang, "Version": Version, "Releasedate": ReleaseDate, "Compatiblek8s": CompatibleK8S, "Compatibleos": CompatibleOS}) + } else { + c.HTML(http.StatusOK, "optresult.tmpl", gin.H{"Label": label, "K8sver": k8sVer, "Opt": "toolswitch", "Result": "failure", "Info": "Failed to set the tool panel!", "Softdir": softDir, "Ostype": osType, "Tools": tools, "Lang": Lang, "Version": Version, "Releasedate": ReleaseDate, "Compatiblek8s": CompatibleK8S, "Compatibleos": CompatibleOS}) + } + } else { + if Lang == "cn" { + c.HTML(http.StatusOK, "optresult.tmpl", gin.H{"Label": label, "K8sver": k8sVer, "Opt": "toolswitch", "Result": "success", "Info": "工具面板设置操作成功!", "Softdir": softDir, "Ostype": osType, "Tools": tools, "Lang": Lang, "Version": Version, "Releasedate": ReleaseDate, "Compatiblek8s": CompatibleK8S, "Compatibleos": CompatibleOS}) + } else { + c.HTML(http.StatusOK, "optresult.tmpl", gin.H{"Label": label, "K8sver": k8sVer, "Opt": "toolswitch", "Result": "success", "Info": "Tool panel setting operation succeeded!", "Softdir": softDir, "Ostype": osType, "Tools": tools, "Lang": Lang, "Version": Version, "Releasedate": ReleaseDate, "Compatiblek8s": CompatibleK8S, "Compatibleos": CompatibleOS}) + } + } + } else { + if Lang == "cn" { + c.HTML(http.StatusOK, "optresult.tmpl", gin.H{"Label": label, "K8sver": k8sVer, "Opt": "toolswitch", "Result": "failure", "Info": "设置失败!请确保你设置了正确的选项。", "Softdir": softDir, "Ostype": osType, "Tools": tools, "Lang": Lang, "Version": Version, "Releasedate": ReleaseDate, "Compatiblek8s": CompatibleK8S, "Compatibleos": CompatibleOS}) + } else { + c.HTML(http.StatusOK, "optresult.tmpl", gin.H{"Label": label, "K8sver": k8sVer, "Opt": "toolswitch", "Result": "failure", "Info": "Setting failed! Please make sure you set the correct options.", "Softdir": softDir, "Ostype": osType, "Tools": tools, "Lang": Lang, "Version": Version, "Releasedate": ReleaseDate, "Compatiblek8s": CompatibleK8S, "Compatibleos": CompatibleOS}) + } + } + }) + // Open the SSH key channel router.POST("/sshkey", func(c *gin.Context) { var form SshKeyForm diff --git a/lib/help.go b/lib/help.go index 5566949..6adffae 100644 --- a/lib/help.go +++ b/lib/help.go @@ -29,11 +29,12 @@ COMMAND: OBJECT: k8sver Specifies the version of k8s software installed.(Default is "1.22") - label In the case of deploying and operating multiple kubernetes clusters, it is necessary to specify a label to uniquely identify a kubernetes cluster. + label In the case of deploying and operating multiple kubernetes clusters, it is necessary to specify a label to uniquely identify a kubernetes cluster.(Length must be less than 32 strings) listen Set the IP and port on which the daemon service listens.(Default is "0.0.0.0:9080") master The IP address of kubernetes master host. node The IP address of kubernetes node host. ostype Specifies the distribution OS type: "centos7 | centos8 | rhel7 | rhel8 | ubuntu20 | suse15". + upgradekernel Because the lower versions of CentOS 7 and redhat 7 may lack kernel modules, only the kernel automatic upgrade of CentOS 7 and rhel7 operating systems is supported here, and other operating systems do not need to be upgraded.(Default is "no") softdir Specifies the installation directory of kubernetes cluster.(Default is "/opt/kube-install") sship The IP address of the target host through which the SSH channel is opened.(Use with "sshcontrol") sshpass The root password of the target host through which the SSH channel is opened.(Use with "sshcontrol") @@ -42,19 +43,19 @@ OBJECT: EXAMPLES: Initialize the system environment: - kube-install -init -ostype "rhel7" + kube-install -init -ostype "rhel8" Open the SSH channel from the local to the target host (You can also get through manually): kube-install -exec sshcontrol -sship "192.168.1.11,192.168.1.12,192.168.1.13,192.168.1.14" -sshpass "cloudnativer" Install kubernetes cluster: - kube-install -exec install -master "192.168.1.11,192.168.1.12,192.168.1.13" -node "192.168.1.11,192.168.1.12,192.168.1.13,192.168.1.14" -k8sver "1.22" -ostype "rhel7" -label "192168001011" + kube-install -exec install -master "192.168.1.11,192.168.1.12,192.168.1.13" -node "192.168.1.11,192.168.1.12,192.168.1.13,192.168.1.14" -k8sver "1.22" -ostype "rhel8" -label "192168001011" Add node to the kubernetes cluster: - kube-install -exec addnode -node "192.168.1.15,192.168.1.16" -k8sver "1.22" -ostype "rhel7" -label "192168001011" + kube-install -exec addnode -node "192.168.1.15,192.168.1.16" -k8sver "1.22" -ostype "rhel8" -label "192168001011" Remove the node from the kubernetes cluster: kube-install -exec delnode -node "192.168.1.13,192.168.1.15" -label "192168001011" Remove the master from the kubernetes cluster: kube-install -exec delmaster -master "192.168.1.13" -label "192168001011" rebuild the damaged kubernetes master: - kube-install -exec rebuildmaster -master "192.168.1.13" -k8sver "1.22" -ostype "rhel7" -label "192168001011" + kube-install -exec rebuildmaster -master "192.168.1.13" -k8sver "1.22" -ostype "rhel8" -label "192168001011" Uninstall kubernetes cluster: kube-install -exec uninstall -master "192.168.1.11,192.168.1.12,192.168.1.13" -node "192.168.1.11,192.168.1.12,192.168.1.13,192.168.1.14" -label "192168001011" Enable this switch to use the web console for management: diff --git a/lib/layout.go b/lib/layout.go index e8f954d..1ca030c 100644 --- a/lib/layout.go +++ b/lib/layout.go @@ -6,10 +6,12 @@ import ( // Generate orchestration for install. -func InstallYML(mode string, softDir string, currentDir string, currentUser string, osType string, logName string) { +func InstallYML(mode string, softDir string, currentDir string, currentUser string, logName string, upgradeKernel string, osTypeResult string) { var osCompatibilityLayout string - if (osType == "centos7") || (osType == "rhel7") { - osCompatibilityLayout = "- remote_user: root\n hosts: node\n gather_facts: no\n roles:\n - "+softDir+"/sys/0x0000000000base/kernel\n" + if upgradeKernel == "yes" { + if osTypeResult == "centos7" || osTypeResult == "rhel7" { + osCompatibilityLayout = "- remote_user: root\n hosts: node\n gather_facts: no\n roles:\n - "+softDir+"/sys/0x0000000000base/kernel\n" + } } install_file, err := os.Create(softDir+"/k8scluster-install.yml") CheckErr(err,currentDir,logName,mode) @@ -18,10 +20,12 @@ func InstallYML(mode string, softDir string, currentDir string, currentUser stri } // Generate orchestration for install one master. -func OnemasterInstallYML(mode string, softDir string, currentDir string, currentUser string, osType string, logName string) { +func OnemasterInstallYML(mode string, softDir string, currentDir string, currentUser string, logName string, upgradeKernel string, osTypeResult string) { var osCompatibilityLayout string - if (osType == "centos7") || (osType == "rhel7") { - osCompatibilityLayout = "- remote_user: root\n hosts: node\n gather_facts: no\n roles:\n - "+softDir+"/sys/0x0000000000base/kernel\n" + if upgradeKernel == "yes" { + if osTypeResult == "centos7" || osTypeResult == "rhel7" { + osCompatibilityLayout = "- remote_user: root\n hosts: node\n gather_facts: no\n roles:\n - "+softDir+"/sys/0x0000000000base/kernel\n" + } } onemasterinstall_file, err := os.Create(softDir+"/k8scluster-onemasterinstall.yml") CheckErr(err,currentDir,logName,mode) @@ -30,10 +34,12 @@ func OnemasterInstallYML(mode string, softDir string, currentDir string, current } // Generate orchestration for add node. -func AddnodeYML(mode string, softDir string, currentDir string, currentUser string, osType string, logName string) { +func AddnodeYML(mode string, softDir string, currentDir string, currentUser string, logName string, upgradeKernel string, osTypeResult string) { var osCompatibilityLayout string - if (osType == "centos7") || (osType == "rhel7") { - osCompatibilityLayout = "- remote_user: root\n hosts: node\n gather_facts: no\n roles:\n - "+softDir+"/sys/0x0000000000base/kernel\n" + if upgradeKernel == "yes" { + if osTypeResult == "centos7" || osTypeResult == "rhel7" { + osCompatibilityLayout = "- remote_user: root\n hosts: node\n gather_facts: no\n roles:\n - "+softDir+"/sys/0x0000000000base/kernel\n" + } } addnode_file, err := os.Create(softDir+"/k8scluster-addnode.yml") CheckErr(err,currentDir,logName,mode) diff --git a/lib/tools.go b/lib/tools.go new file mode 100644 index 0000000..9be5b19 --- /dev/null +++ b/lib/tools.go @@ -0,0 +1,27 @@ +package kilib + +import ( + "strings" +) + + +// Read tools switch information +func GetToolSwitch(currentDir string, logName string, mode string) []string { + toolSwitch := []string{"on", "on", "on"} + toolSwitchData, _ := ReadFile(currentDir + "/data/config/tools.txt") + if toolSwitchData != "" { + toolSwitch = strings.Split(toolSwitchData, ",") + } + return toolSwitch +} + +// Switch tools status +func SetToolSwitch(sshTool string, installTool string, calendarTool string, currentDir string, logName string, mode string) error { + toolswitch := sshTool + "," + installTool + "," + calendarTool + err := DatabaseUpdate(currentDir+"/data/config/tools.txt", toolswitch, currentDir, logName, mode) + return err +} + + + + diff --git a/static/html/1 b/static/html/1 new file mode 100644 index 0000000..24249e1 --- /dev/null +++ b/static/html/1 @@ -0,0 +1,367 @@ + + + + + + + {{if eq .Lang "cn"}}Kube-Install(二进制方式部署K8S集群){{else}}Kube-Install(installation of K8S in binary mode){{end}} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+

{{if eq .Lang "cn"}}打通kube-install到目标主机的SSH通道{{else}}Open the SSH channel from kube-install to the target host{{end}}

+
{{if eq .Lang
+
+
+
+
+
{{if eq .Lang "cn"}}目标主机的IP地址{{else}}IP address of the target host{{end}} *
+
+ +
{{if eq .Lang "cn"}}填写目标主机的IP地址,多个IP请用英文逗号","隔开{{else}}The IP address of the target host to operation, separate multiple IP addresses with English comma ","{{end}}
+
+
+
+
{{if eq .Lang "cn"}}目标主机的{{.Sshuser}}密码{{else}}{{.Sshuser}} password of the target host{{end}} *
+
+ +
{{if eq .Lang "cn"}}填写目标主机{{.Sshuser}}用户的密码{{else}}The password of the {{.Sshuser}} user of the target host{{end}}
+
+
+
+
{{if eq .Lang "cn"}}注意:如果想用Kube-Install管理目标主机,就必须要先打通Kube-Install服务器到目标主机的SSH通道。(你可以选择手工自己打通主机SSH通道,也可以通过Kube-Install来自动化打通){{else}}Notice: If you want to use Kube-Install to manage the target host, you must first open the SSH channel from the Kube-Install server to the target host.(You can choose to open the SSH channel of the host manually or automatically through Kube install){{end}}
+
+
+
+ +      + +


+
+
+
+
+
+ +
+
+
+

{{if eq .Lang "cn"}}快速安装一个新Kubernetes集群{{else}}Fast installation of a new kubernetes cluster{{end}}

+
{{if eq .Lang
+
+
+
+
+
{{if eq .Lang "cn"}}Kubernetes集群标示{{else}}Kubernetes cluster label{{end}} *
+
+ +
{{if eq .Lang "cn"}}填写用于唯一识别这个Kubernetes集群的标示字段(Label长度必须小于32个字符){{else}}Fill in the label field that uniquely identifies the kubernetes cluster (Length must be less than 32 strings){{end}}
+
+
+
+
{{if eq .Lang "cn"}}选择Kubernetes版本{{else}}Kubernetes version{{end}} * +
+
+ +
{{if eq .Lang "cn"}}选择你要安装的Kubernetes软件版本{{else}}Select the version of kubernetes software you want to install.{{end}}
+
+
+
+
{{if eq .Lang "cn"}}Master IP地址{{else}}Master IP address{{end}} *
+
+ +
{{if eq .Lang "cn"}}填写要部署的Kubernetes Master主机IP地址,多个IP请用英文逗号","隔开{{else}}Fill in the IP address of the kubernetes master to be deployed. Separate multiple IP addresses with English comma ","{{end}}
+
+
+
+
{{if eq .Lang "cn"}}Node IP地址{{else}}Node IP address{{end}} *
+
+ +
{{if eq .Lang "cn"}}填写要部署的Kubernetes Node主机IP地址,多个IP请用英文逗号","隔开{{else}}Fill in the IP address of the kubernetes node host to be deployed. Separate multiple IP addresses with English comma ","{{end}}
+
+
+
+
{{if eq .Lang "cn"}}操作系统类型{{else}}Operating system type{{end}}* +
+
+ +
{{if eq .Lang "cn"}}选择目标主机的操作系统类型。相同批次的主机操作系统需要保持一致{{else}}Select the operating system type of the target host. Host operating systems of the same batch need to be consistent!{{end}}
+
+
+
+
{{if eq .Lang "cn"}}自动升级OS内核{{else}}Automatically upgrade OS kernel{{end}}
+
+              +
{{if eq .Lang "cn"}}由于低版本的centos7和redhat7可能缺少内核模块,这里仅支持centos7和rhel7操作系统内核的自动升级。其他操作系统不用做升级。{{else}}Because the lower versions of CentOS 7 and red hat 7 may lack kernel modules, only the kernel automatic upgrade of CentOS 7 and rhel7 operating systems is supported here, and other operating systems do not need to be upgraded. {{end}}
+
+
+
+
{{if eq .Lang "cn"}}部署到目标主机路径{{else}}Deploy to target host path{{end}} *
+
+ +
{{if eq .Lang "cn"}}默认无需修改。如果所安装的目标主机路径需要更换的话,可以通过这里进行修改。{{else}}No modification is required by default. If the installed target host path needs to be changed, you can modify it here.{{end}}
+
+
+
+
{{if eq .Lang "cn"}}选择开始安装的时间{{else}}Select when to start installation{{end}}
+
+ + +
{{if eq .Lang "cn"}}默认立即开始安装。如需定时安装,可以在这里设置计划开始执行的时间。(任务计划支持精确到分钟级别)
注意:请确保Kube-Install本地操作系统的当前时间与Web页面当前时间一致!{{else}}Install now by default. For scheduled installation, you can set the scheduled execution time here.(Support accuracy to minute level)
Notice: Please ensure that the current time of local OS is consistent with the current time of web page!{{end}}
+
+
+
+
+ +      + +
+
+
+
+
+ +
+
+ + +
+
+ +
+ +
+ +
+ + + +
+
+ +
+

Kubernetes{{if eq .Lang "cn"}}集群管理{{else}} Cluster Management{{end}}

+
{{if eq .Lang "cn"}}Kubernetes{{if eq .Lang "cn"}}集群的{{else}}cluster{{end}}安装、卸载、节点管理、信息查看等{{if eq .Lang "cn"}}操作{{else}}operation{{end}}{{else}}Kubernetes cluster installation, uninstall, information view {{end}}
+
+ +
+
+
{{if eq .Lang "cn"}}快速安装新Kubernetes集群{{else}}Install Kubernetes{{end}}
+
+
+
{{if eq .Lang "cn"}}打通目标主机SSH通道{{else}}Open SSH Channel of Host{{end}}
+
+
+ +
+
+
+ + + + + + + + + + + + + {{ range $v := .Clusterlist}} + {{ if ne $v.Status "notinstall" }} + + + + + + + + + {{ end }} + {{ end }} + +
{{if eq .Lang "cn"}}集群标示{{else}}Cluster Label{{end}}{{if eq .Lang "cn"}}K8S版本{{else}}K8S Version{{end}}{{if eq .Lang "cn"}}Master IP地址{{else}}Master IP Address{{end}}{{if eq .Lang "cn"}}集群部署状态{{else}}Installation Status{{end}}{{if eq .Lang "cn"}}定时安装{{else}}Installation Schedule{{end}}{{if eq .Lang "cn"}}更多操作{{else}}More Operation{{end}}
{{ if eq $v.K8t ".default" }} {{if eq .Lang "cn"}}默认{{else}}default{{end}}集群 {{else}} {{$v.K8t}} {{end}}{{ $v.K8v }}{{ $v.Master }} + {{ if eq $v.Status "installing" }}
{{if eq .Lang "cn"}}安装中{{else}}Installing{{end}}
{{end}} + {{ if eq $v.Status "restarting" }}
{{if eq .Lang "cn"}}重启中{{else}}Restarting{{end}}{{end}} + {{ if eq $v.Status "uninstalling" }}
{{if eq .Lang "cn"}}卸载中{{else}}Uninstalling{{end}}
{{end}} + {{ if eq $v.Status "ok" }}
{{if eq .Lang "cn"}}正常{{else}}OK{{end}}{{end}} + {{ if eq $v.Status "notok" }}
{{if eq .Lang "cn"}}异常{{else}}Error{{end}}{{end}} + {{ if eq $v.Status "notinstall" }}
{{if eq .Lang "cn"}}未部署{{else}}Not installed{{end}}{{end}} + {{ if eq $v.Status "unknow" }}
{{if eq .Lang "cn"}}未知状态{{else}}Unknow{{end}}{{end}} +
+ {{ if eq $v.Scheduler "on" }} 已开启
{{.Instime}} + {{else}}未开启
{{if eq .Lang "cn"}}暂无{{else}}Disabled{{end}}{{end}} +
+ {{ if eq $v.Status "unknow" }}   {{if eq $v.Lang "cn"}}查看详细{{else}}View Details{{end}}   |{{end}} {{ if eq $v.Status "ok" }}   {{if eq $v.Lang "cn"}}查看详细{{else}}View Details{{end}}     {{if eq $v.Lang "cn"}}Web控制台{{else}}Kube-Dashboard{{end}}   |   {{if eq $v.Lang "cn"}}Master管理{{else}}Master Management{{end}}     {{if eq $v.Lang "cn"}}Node管理{{else}}Node Management{{end}}   {{end}} + {{ if eq $v.Scheduler "on" }} +   {{if eq .Lang "cn"}}取消定时安装{{else}}Remove Installation Schedule{{end}}   + {{else}} + {{ if ne $v.Status "installing" }}{{ if ne $v.Status "uninstalling" }}{{ if ne $v.Status "restarting" }}   {{if eq .Lang "cn"}}重装K8S集群{{else}}Reinstall{{end}}   {{end}}{{end}}{{end}} + {{ if ne $v.Status "installing" }}{{ if ne $v.Status "uninstalling" }}{{ if ne $v.Status "restarting" }}   {{if eq .Lang "cn"}}卸载K8S集群{{else}}Uninstall{{end}}   {{end}}{{end}}{{end}} + {{end}} + {{ if eq $v.Status "ok" }}|{{end}}   {{if eq $v.Lang "cn"}}安装日志{{else}}Install Log{{end}}     {{if eq $v.Lang "cn"}}卸载日志{{else}}Uninstall Log{{end}}   +
+
+
+
+
+ + + + diff --git a/static/html/calendarscheduler.tmpl b/static/html/calendarscheduler.tmpl index 6d6417c..b1325be 100644 --- a/static/html/calendarscheduler.tmpl +++ b/static/html/calendarscheduler.tmpl @@ -98,7 +98,7 @@

-
{{if eq .Lang "cn"}}*.上面的日历中会显示Kubernetes集群标签、正在安装或计划安装的时间日程。(如果是刚制定的安装任务计划,可能需要等待1分钟后才能显示到日历上面) {{else}}*.The calendar above shows the kubernetes cluster label, the time schedule of the installation in progress or planned. (The task plan just made needs to wait 1 minute to display) {{end}}
+
{{if eq .Lang "cn"}}*.上面的日历中会显示正在安装或计划安装的时间日程、Kubernetes集群标签。(如果是刚制定的安装任务计划,可能需要等待1分钟后才能显示到日历上面) {{else}}*.The calendar above shows the kubernetes cluster label, the time schedule of the installation in progress or planned. (The task plan just made needs to wait 1 minute to display) {{end}}
diff --git a/static/html/cluster.tmpl b/static/html/cluster.tmpl index fbc58d2..c892f19 100644 --- a/static/html/cluster.tmpl +++ b/static/html/cluster.tmpl @@ -52,6 +52,22 @@ +
@@ -103,7 +119,7 @@
{{if eq .Lang "cn"}}Kubernetes集群标示{{else}}Kubernetes cluster label{{end}} *
-
{{if eq .Lang "cn"}}填写用于唯一识别这个Kubernetes{{if eq .Lang "cn"}}集群的{{else}}cluster{{end}}标示字段{{else}}Fill in the label field that uniquely identifies the kubernetes cluster{{end}}
+
{{if eq .Lang "cn"}}填写用于唯一识别这个Kubernetes集群的标示字段(Label长度必须小于32个字符){{else}}Fill in the label field that uniquely identifies the kubernetes cluster (Length must be less than 32 strings){{end}}
@@ -140,7 +156,7 @@
{{if eq .Lang "cn"}}操作系统类型{{else}}Operating system type{{end}}*
- @@ -151,6 +167,13 @@
{{if eq .Lang "cn"}}选择目标主机的操作系统类型。相同批次的主机操作系统需要保持一致{{else}}Select the operating system type of the target host. Host operating systems of the same batch need to be consistent!{{end}}
+
+
{{if eq .Lang "cn"}}自动升级OS内核{{else}}Automatically upgrade OS kernel{{end}}
+
+              +
{{if eq .Lang "cn"}}由于低版本的centos7和redhat7可能缺少内核模块,这里仅支持centos7和rhel7操作系统内核的自动升级。其他操作系统不用做升级。{{else}}Because the lower versions of CentOS 7 and redhat 7 may lack kernel modules, only the kernel automatic upgrade of CentOS 7 and rhel7 operating systems is supported here, and other operating systems do not need to be upgraded. {{end}}
+
+
{{if eq .Lang "cn"}}部署到目标主机路径{{else}}Deploy to target host path{{end}} *
@@ -198,7 +221,7 @@
- + {{if eq .Lang "cn"}} {{else}} @@ -330,14 +353,14 @@ {{else}}未开启
{{if eq .Lang "cn"}}暂无{{else}}Disabled{{end}}{{end}} - {{ if eq $v.Status "unknow" }}
  {{if eq $v.Lang "cn"}}查看详细{{else}}View Details{{end}}   {{end}} {{ if eq $v.Status "ok" }}   {{if eq $v.Lang "cn"}}查看详细{{else}}View Details{{end}}     {{if eq $v.Lang "cn"}}Web控制台{{else}}Kube-Dashboard{{end}}   |   {{if eq $v.Lang "cn"}}Master管理{{else}}Master Management{{end}}     {{if eq $v.Lang "cn"}}Node管理{{else}}Node Management{{end}}   {{end}} + {{ if eq $v.Status "unknow" }}   {{if eq $v.Lang "cn"}}查看详细{{else}}View Details{{end}}   |{{end}} {{ if eq $v.Status "ok" }}   {{if eq $v.Lang "cn"}}查看详细{{else}}View Details{{end}}     {{if eq $v.Lang "cn"}}Web控制台{{else}}Kube-Dashboard{{end}}   |   {{if eq $v.Lang "cn"}}Master管理{{else}}Master Management{{end}}     {{if eq $v.Lang "cn"}}Node管理{{else}}Node Management{{end}}   {{end}} {{ if eq $v.Scheduler "on" }} -   {{if eq .Lang "cn"}}取消定时安装{{else}}Remove Installation Schedule{{end}}   +   {{if eq .Lang "cn"}}取消定时安装{{else}}Remove Installation Schedule{{end}}   {{else}} - {{ if ne $v.Status "installing" }}{{ if ne $v.Status "uninstalling" }}   {{if eq .Lang "cn"}}重装K8S集群{{else}}Reinstall{{end}}   {{end}}{{end}} - {{ if ne $v.Status "installing" }}{{ if ne $v.Status "uninstalling" }}   {{if eq .Lang "cn"}}卸载K8S集群{{else}}Uninstall{{end}}   |{{end}}{{end}} + {{ if ne $v.Status "installing" }}{{ if ne $v.Status "uninstalling" }}{{ if ne $v.Status "restarting" }}   {{if eq .Lang "cn"}}重装K8S集群{{else}}Reinstall{{end}}   {{end}}{{end}}{{end}} + {{ if ne $v.Status "installing" }}{{ if ne $v.Status "uninstalling" }}{{ if ne $v.Status "restarting" }}   {{if eq .Lang "cn"}}卸载K8S集群{{else}}Uninstall{{end}}   {{end}}{{end}}{{end}} {{end}} -   {{if eq $v.Lang "cn"}}安装日志{{else}}Install Log{{end}}     {{if eq $v.Lang "cn"}}卸载日志{{else}}Uninstall Log{{end}}   + {{ if eq $v.Status "ok" }}|{{end}}   {{if eq $v.Lang "cn"}}安装日志{{else}}Install Log{{end}}     {{if eq $v.Lang "cn"}}卸载日志{{else}}Uninstall Log{{end}}   {{ end }} diff --git a/static/html/clusteradd.tmpl b/static/html/clusteradd.tmpl index ac8ebdf..6eba54e 100644 --- a/static/html/clusteradd.tmpl +++ b/static/html/clusteradd.tmpl @@ -51,6 +51,27 @@ +
@@ -103,10 +124,10 @@
{{if eq .Lang "cn"}}操作系统类型{{else}}Operating system type{{end}} *
- - + @@ -114,6 +135,13 @@
{{if eq .Lang "cn"}}选择目标主机的操作系统类型。相同批次的主机操作系统需要保持一致{{else}}Select the operating system type of the target host. Host operating systems of the same batch need to be consistent!{{end}}
+
+
{{if eq .Lang "cn"}}自动升级OS内核{{else}}Automatically upgrade OS kernel{{end}}
+
+              +
{{if eq .Lang "cn"}}由于低版本的centos7和redhat7可能缺少内核模块,这里仅支持centos7和rhel7操作系统内核的自动升级。其他操作系统不用做升级。{{else}}Because the lower versions of CentOS 7 and redhat 7 may lack kernel modules, only the kernel automatic upgrade of CentOS 7 and rhel7 operating systems is supported here, and other operating systems do not need to be upgraded. {{end}}
+
+
{{if eq .Lang "cn"}}部署到目标主机路径{{else}}Deploy to target host path{{end}} *
diff --git a/static/html/clusterinfo.tmpl b/static/html/clusterinfo.tmpl index de29cf9..e6330ed 100644 --- a/static/html/clusterinfo.tmpl +++ b/static/html/clusterinfo.tmpl @@ -73,7 +73,7 @@ {{if eq .Lang "cn"}}Kubernetes Node:{{else}}Kubernetes Node:{{end}}{{ .Node }} ETCD Endpoints:{{ .Etcdendpoints }} {{if eq .Lang "cn"}}容器镜像仓库:{{else}}Image Registry:{{end}}http://{{ .Registryip }}:5000
{{ .Registryusage }} - {{if eq .Lang "cn"}}Web管理控制台:{{else}}Kube-Dashboard:{{end}}https://{{ .K8sdashboardip }}:50000
{{ .K8sdashboardusage }} + {{if eq .Lang "cn"}}Web管理控制台:{{else}}Kube-Dashboard:{{end}}https://{{ .K8sdashboardip }}:32767
{{ .K8sdashboardusage }} KubeConfig:{{ .Kubeconfig }}
diff --git a/static/html/deleteschedule.tmpl b/static/html/deleteschedule.tmpl index 645a724..d7fe43d 100644 --- a/static/html/deleteschedule.tmpl +++ b/static/html/deleteschedule.tmpl @@ -64,21 +64,35 @@
{{if eq .Lang "cn"}}Kubernetes集群标示{{else}}Kubernetes cluster label{{end}}
-
{{if eq .Lang "cn"}}禁止修改。这是唯一识别这个Kubernetes集群的标示字段{{else}}Modification is prohibited at this time.This is the label field that uniquely identifies the kubernetes cluster{{end}}
+
{{if eq .Lang "cn"}}唯一识别这个Kubernetes集群的标示{{else}}This is the label that uniquely identifies the kubernetes cluster.{{end}}
+
+
+
+
{{if eq .Lang "cn"}}Master IP地址{{else}}Master IP address{{end}}
+
+ +
{{if eq .Lang "cn"}}计划安装的Kubernetes Master主机IP地址{{else}}IP address of kubernetes master host to be installed.{{end}}
+
+
+
+
{{if eq .Lang "cn"}}Node IP地址{{else}}Node IP address{{end}}
+
+ +
{{if eq .Lang "cn"}}计划安装的Kubernetes Node主机IP地址{{else}}IP address of kubernetes node host to be installed.{{end}}
{{if eq .Lang "cn"}}计划安装的时间{{else}}Scheduled installation time{{end}}
-
{{if eq .Lang "cn"}}禁止修改。这是计划安装的开始时间。{{else}}Modification is prohibited at this time.This is the start time of the installation.{{end}}
+
{{if eq .Lang "cn"}}计划安装的开始时间。{{else}}This is the start time of the installation.{{end}}
{{if eq .Lang "cn"}}任务状态{{else}}Schedule Status{{end}}
-
{{if eq .Lang "cn"}}禁止修改。这是计划任务状态情况。{{else}}Modification is prohibited at this time.This is the status of the schedule.{{end}}
+
{{if eq .Lang "cn"}}计划任务的当前状态。{{else}}This is the status of the schedule.{{end}}
@@ -197,7 +211,7 @@
- kubernetes cluster uninstall + Remove Installation Schedule
diff --git a/static/html/index.tmpl b/static/html/index.tmpl index 5222fce..a011f97 100644 --- a/static/html/index.tmpl +++ b/static/html/index.tmpl @@ -122,7 +122,7 @@
@@ -237,7 +237,7 @@
-

{{if eq .Lang "cn"}}{{if eq .Lang "cn"}}K8S集群部署状态{{else}}K8s cluster installation status{{end}}占比{{else}}Proportion of Kubernetes Installation Status{{end}}

+

{{if eq .Lang "cn"}}{{if eq .Lang "cn"}}Kubernetes集群部署状态{{else}}K8s cluster installation status{{end}}占比{{else}}Proportion of Kubernetes Installation Status{{end}}

@@ -246,7 +246,7 @@
-

{{if eq .Lang "cn"}}K8S集群节点数量Top5{{else}}Top 5 Number of Kubernetes Nodes{{end}}

+

{{if eq .Lang "cn"}}Kubernetes集群节点数量Top5{{else}}Top 5 Number of Kubernetes Nodes{{end}}

diff --git a/static/html/logs.tmpl b/static/html/logs.tmpl index 7e40318..3b98e01 100644 --- a/static/html/logs.tmpl +++ b/static/html/logs.tmpl @@ -65,7 +65,7 @@
- + {{if eq .Lang "cn"}} {{else}} diff --git a/static/html/master.tmpl b/static/html/master.tmpl index 8cd2d34..bfd3cde 100644 --- a/static/html/master.tmpl +++ b/static/html/master.tmpl @@ -239,7 +239,7 @@ {{ if eq .TTYstatus "enable" }} {{if eq .Lang "cn"}}已启用{{else}}Enable{{end}} {{else}} {{if eq .Lang "cn"}}已禁用{{else}}Disable{{end}}{{end}} - {{ if eq .Masterstatus "ok" }}  {{if eq .Lang "cn"}}查看详细{{else}}View Details{{end}}  {{end}} {{ if eq .TTYstatus "enable" }}  {{if eq .Lang "cn"}}登录终端{{else}}Web Terminal{{end}}  {{end}} | {{ if eq .TTYstatus "enable" }}   {{if eq .Lang "cn"}}禁用终端{{else}}Disable Terminal{{end}}   {{else}}   {{if eq .Lang "cn"}}启用终端{{else}}Enable Terminal{{end}}   {{end}} + {{ if eq .Masterstatus "ok" }}  {{if eq .Lang "cn"}}查看详细{{else}}View Details{{end}}   {{ if ne .TTYstatus "enable" }}|{{end}}{{end}} {{ if eq .TTYstatus "enable" }}  {{if eq .Lang "cn"}}登录终端{{else}}Web Terminal{{end}}   |{{end}} {{ if eq .TTYstatus "enable" }}   {{if eq .Lang "cn"}}禁用终端{{else}}Disable Terminal{{end}}   {{else}}   {{if eq .Lang "cn"}}启用终端{{else}}Enable Terminal{{end}}   {{end}} {{end}} diff --git a/static/html/node.tmpl b/static/html/node.tmpl index 6c2c372..702b533 100644 --- a/static/html/node.tmpl +++ b/static/html/node.tmpl @@ -331,7 +331,7 @@ {{ if eq .TTYstatus "enable" }} {{if eq .Lang "cn"}}已启用{{else}}Enable{{end}} {{else}} {{if eq .Lang "cn"}}已禁用{{else}}Disable{{end}}{{end}} - {{ if eq .Nodestatus "ok" }}  {{if eq .Lang "cn"}}查看详细{{else}}View Details{{end}}  {{end}} {{ if eq .TTYstatus "enable" }}  {{if eq .Lang "cn"}}登录终端{{else}}Web Terminal{{end}}  {{end}} | {{ if eq .TTYstatus "enable" }}   {{if eq .Lang "cn"}}禁用终端{{else}}Disable Terminal{{end}}   {{else}}   {{if eq .Lang "cn"}}启用终端{{else}}Enable Terminal{{end}}   {{end}} + {{ if eq .Nodestatus "ok" }}  {{if eq .Lang "cn"}}查看详细{{else}}View Details{{end}}   {{ if ne .TTYstatus "enable" }}|{{end}}{{end}} {{ if eq .TTYstatus "enable" }}  {{if eq .Lang "cn"}}登录终端{{else}}Web Terminal{{end}}   |{{end}} {{ if eq .TTYstatus "enable" }}   {{if eq .Lang "cn"}}禁用终端{{else}}Disable Terminal{{end}}   {{else}}   {{if eq .Lang "cn"}}启用终端{{else}}Enable Terminal{{end}}   {{end}} {{end}}{{end}} diff --git a/static/html/optresult.tmpl b/static/html/optresult.tmpl index cda482d..b31e9ad 100644 --- a/static/html/optresult.tmpl +++ b/static/html/optresult.tmpl @@ -57,9 +57,9 @@ var timer = setInterval(function(){ if(i == -1){ clearInterval(timer); - document.write("如果页面没有自动跳转,也可以点击这里返回原页面!"); + document.write("如果页面没有自动跳转,也可以点击这里返回原页面!"); }else{ - out.innerHTML=i+" {{if eq .Lang "cn"}}秒钟后自动跳转回原页面!{{else}}seconds, automatically jump back to the original page!{{end}}"; + out.innerHTML=i+" {{if eq .Lang "cn"}}秒钟后自动跳转回原页面!{{else}}seconds, automatically jump back to the original page!{{end}}"; --i; } },1000); @@ -70,7 +70,7 @@
-

{{ if ne .Label "" }} {{ if eq .Label ".default" }} {{if eq .Lang "cn"}}默认{{else}}default{{end}} {{else}} {{.Label}} {{end}} {{end}}{{if eq .Lang "cn"}}集群的{{else}}Cluster{{end}} {{ .Opt }} {{if eq .Lang "cn"}}操作信息{{else}}Operation Information{{end}}

+

{{ .Opt }} {{if eq .Lang "cn"}}操作结果信息{{else}}Operation Result Information{{end}}





diff --git a/static/html/tools.tmpl b/static/html/tools.tmpl index 87f8828..d533d7c 100644 --- a/static/html/tools.tmpl +++ b/static/html/tools.tmpl @@ -51,12 +51,123 @@ + +
+
+
+
+

{{if eq .Lang "cn"}}显示或隐藏工具{{else}}Show or Hide Tools{{end}}

+
{{if eq .Lang
+
+
+
+
+
+
+ +                  + +
{{if eq .Lang "cn"}}你可以设置“打通主机SSH通道”工具是否显示在“工具面板”页面上{{else}}Set whether the tool of "Open SSH Channel of Host" is displayed or hidden on the "Tool Panel"{{end}}
+
+
+
+
+
+ +                  + +
{{if eq .Lang "cn"}}你可以设置“一键部署K8S集群”工具是否显示在“工具面板”页面上{{else}}Set whether the tool of "Fast Installation of K8S" is displayed or hidden on the "Tool Panel"{{end}}
+
+
+
+
+
+ +                  + +
{{if eq .Lang "cn"}}你可以设置“查看部署计划日历”工具是否显示在“工具面板”页面上{{else}}Set whether the tool of "Install Schedule Calendar" is displayed or hidden on the "Tool Panel"{{end}}
+
+
+
+
              {{if eq .Lang "cn"}}说明:请在上面设置你要显示或隐藏的工具,然后点击“确认设置”按钮生效。{{else}}Explain: Please set the tools you want to show or hide, and then click the “Submit” button to take effect.{{end}}
+


+
+ + + + + +      + +
+




+
+
+
+
+ +
+
+
+
+

{{if eq .Lang "cn"}}打通kube-install到目标主机的SSH通道{{else}}Open the SSH channel from kube-install to the target host{{end}}

+
{{if eq .Lang
+
+
+
+
+
{{if eq .Lang "cn"}}目标主机的IP地址{{else}}IP address of the target host{{end}} *
+
+ +
{{if eq .Lang "cn"}}填写目标主机的IP地址,多个IP请用英文逗号","隔开{{else}}The IP address of the target host to operation, Separate multiple IP addresses with English comma ","{{end}}
+
+
+
+
{{if eq .Lang "cn"}}目标主机的{{.Sshuser}}密码{{else}}{{.Sshuser}} password of the target host{{end}} *
+
+ +
{{if eq .Lang "cn"}}填写目标主机{{.Sshuser}}用户的密码{{else}}The password of the {{.Sshuser}} user of the target host{{end}}
+
+
+
+
{{if eq .Lang "cn"}}注意:如果想用Kube-Install管理目标主机,就必须要先打通Kube-Install服务器到目标主机的SSH通道。(你可以选择手工自己打通主机SSH通道,也可以通过Kube-Install来自动化打通){{else}}Notice: If you want to use Kube-Install to manage the target host, you must first open the SSH channel from the Kube-Install server to the target host.(You can choose to open the SSH channel of the host manually or automatically through Kube install){{end}}
+


+
+ + + + + +      + +
+




+
+
+
+
+
-

{{if eq .Lang "cn"}}快速安装一个新k8s集群{{else}}Fast installation of a new kubernetes cluster{{end}}

+

{{if eq .Lang "cn"}}快速安装一个新Kubernetes集群{{else}}Fast installation of a new kubernetes cluster{{end}}

{{if eq .Lang
@@ -65,7 +176,7 @@
{{if eq .Lang "cn"}}Kubernetes集群标示{{else}}Kubernetes cluster label{{end}} *
-
{{if eq .Lang "cn"}}填写用于唯一识别这个Kubernetes{{if eq .Lang "cn"}}集群的{{else}}cluster{{end}}标示字段{{else}}Fill in the label field that uniquely identifies the kubernetes cluster{{end}}
+
{{if eq .Lang "cn"}}填写用于唯一识别这个Kubernetes集群的标示字段(Label长度必须小于32个字符){{else}}Fill in the label field that uniquely identifies the kubernetes cluster (Length must be less than 32 strings){{end}}
@@ -102,7 +213,7 @@
{{if eq .Lang "cn"}}操作系统类型{{else}}Operating system type{{end}} *
- @@ -113,6 +224,13 @@
{{if eq .Lang "cn"}}选择目标主机的操作系统类型。相同批次的主机操作系统需要保持一致{{else}}Select the operating system type of the target host. Host operating systems of the same batch need to be consistent!{{end}}
+
+
{{if eq .Lang "cn"}}自动升级OS内核{{else}}Automatically upgrade OS kernel{{end}}
+
+              +
{{if eq .Lang "cn"}}由于低版本的centos7和redhat7可能缺少内核模块,这里仅支持centos7和rhel7操作系统内核的自动升级。其他操作系统不用做升级。{{else}}Because the lower versions of CentOS 7 and redhat 7 may lack kernel modules, only the kernel automatic upgrade of CentOS 7 and rhel7 operating systems is supported here, and other operating systems do not need to be upgraded. {{end}}
+
+
{{if eq .Lang "cn"}}部署到目标主机路径{{else}}Deploy to target host path{{end}} *
@@ -147,47 +265,6 @@
-
-
-
-
-

{{if eq .Lang "cn"}}打通kube-install到目标主机的SSH通道{{else}}Open the SSH channel from kube-install to the target host{{end}}

-
{{if eq .Lang
-
-
-
-
-
{{if eq .Lang "cn"}}目标主机的IP地址{{else}}IP address of the target host{{end}} *
-
- -
{{if eq .Lang "cn"}}填写目标主机的IP地址,多个IP请用英文逗号","隔开{{else}}The IP address of the target host to operation, Separate multiple IP addresses with English comma ","{{end}}
-
-
-
-
{{if eq .Lang "cn"}}目标主机的{{.Sshuser}}密码{{else}}{{.Sshuser}} password of the target host{{end}} *
-
- -
{{if eq .Lang "cn"}}填写目标主机{{.Sshuser}}用户的密码{{else}}The password of the {{.Sshuser}} user of the target host{{end}}
-
-
-
-
{{if eq .Lang "cn"}}注意:如果想用Kube-Install管理目标主机,就必须要先打通Kube-Install服务器到目标主机的SSH通道。(你可以选择手工自己打通主机SSH通道,也可以通过Kube-Install来自动化打通){{else}}Notice: If you want to use Kube-Install to manage the target host, you must first open the SSH channel from the Kube-Install server to the target host.(You can choose to open the SSH channel of the host manually or automatically through Kube install){{end}}
-


-
- - - - - -      - -
-




-
-
-
-
-
diff --git a/sys/0x0000000000base/all/templates/kubernetes.conf b/sys/0x0000000000base/all/templates/kubernetes.conf index c5ee7f2..4fab9ed 100755 --- a/sys/0x0000000000base/all/templates/kubernetes.conf +++ b/sys/0x0000000000base/all/templates/kubernetes.conf @@ -2,6 +2,7 @@ net.bridge.bridge-nf-call-iptables = 1 net.bridge.bridge-nf-call-ip6tables = 1 net.bridge.bridge-nf-call-arptables = 0 net.ipv4.ip_forward = 1 +net.ipv4.ip_local_port_range = 32768 60999 vm.swappiness = 0 vm.overcommit_memory = 1 vm.panic_on_oom = 0 diff --git a/sys/0x00000000action/clearresidue/tasks/main.yml b/sys/0x00000000action/clearresidue/tasks/main.yml index 757ba33..370e73b 100644 --- a/sys/0x00000000action/clearresidue/tasks/main.yml +++ b/sys/0x00000000action/clearresidue/tasks/main.yml @@ -18,12 +18,22 @@ path: /usr/local/bin/ttyd state: absent ignore_errors: yes -- name: 4.Delete kubectl file +- name: 4.Delete sysctl configuration + file: + path: /etc/sysctl.d/kubernetes.conf + state: absent + ignore_errors: yes +- name: 5.Delete modules configuration + file: + path: /etc/sysconfig/modules/ipvs.modules + state: absent + ignore_errors: yes +- name: 6.Delete kubectl file file: path: /usr/sbin/kubectl state: absent ignore_errors: yes -- name: 5.Delete other bin file +- name: 7.Delete other bin file file: path: /usr/local/bin/{{item}} state: absent @@ -55,3 +65,5 @@ - static - vlan ignore_errors: yes + + diff --git a/sys/0x00000000addons/templates/2.dashboard/kubernetes-dashboard-deployment.yaml.j2 b/sys/0x00000000addons/templates/2.dashboard/kubernetes-dashboard-deployment.yaml.j2 index 870a5f3..33d547f 100644 --- a/sys/0x00000000addons/templates/2.dashboard/kubernetes-dashboard-deployment.yaml.j2 +++ b/sys/0x00000000addons/templates/2.dashboard/kubernetes-dashboard-deployment.yaml.j2 @@ -26,7 +26,7 @@ spec: - key: dashboard operator: In values: - - trunon + - turnon weight: 100 priorityClassName: system-cluster-critical containers: diff --git a/sys/0x00000000addons/templates/2.dashboard/kubernetes-dashboard-service.yaml.j2 b/sys/0x00000000addons/templates/2.dashboard/kubernetes-dashboard-service.yaml.j2 index 8e2260e..cdc2f15 100644 --- a/sys/0x00000000addons/templates/2.dashboard/kubernetes-dashboard-service.yaml.j2 +++ b/sys/0x00000000addons/templates/2.dashboard/kubernetes-dashboard-service.yaml.j2 @@ -14,6 +14,6 @@ spec: ports: - port: 443 targetPort: 8443 - nodePort: 50000 + nodePort: 32767 diff --git a/sys/0x00000000master/admintoken/templates/loginkey.txt.j2 b/sys/0x00000000master/admintoken/templates/loginkey.txt.j2 index 07ee74e..463df29 100644 --- a/sys/0x00000000master/admintoken/templates/loginkey.txt.j2 +++ b/sys/0x00000000master/admintoken/templates/loginkey.txt.j2 @@ -6,6 +6,6 @@ --------------------------------------------------------------- -[2] k8s dashboard console: https://{{addons_ip1}}:50000 +[2] k8s dashboard console: https://{{addons_ip1}}:32767 usage method: Use the browser to log in and access. The token is as follows: diff --git a/sys/0x00000000master/apiserver/templates/kube-apiserver.service-1.17.j2 b/sys/0x00000000master/apiserver/templates/kube-apiserver.service-1.17.j2 index b7b5f14..35ae7fe 100755 --- a/sys/0x00000000master/apiserver/templates/kube-apiserver.service-1.17.j2 +++ b/sys/0x00000000master/apiserver/templates/kube-apiserver.service-1.17.j2 @@ -21,7 +21,7 @@ ExecStart=/usr/local/bin/kube-apiserver \ --enable-bootstrap-token-auth \ --token-auth-file=/etc/kubernetes/ssl/token.csv \ --service-cluster-ip-range={{service_cidr}} \ ---service-node-port-range=5000-55000 \ +--service-node-port-range=5000-32767 \ --tls-cert-file=/etc/kubernetes/ssl/kubernetes.pem \ --tls-private-key-file=/etc/kubernetes/ssl/kubernetes-key.pem \ --kubelet-client-certificate=/etc/kubernetes/ssl/kubernetes.pem \ diff --git a/sys/0x00000000master/apiserver/templates/kube-apiserver.service-1.18.j2 b/sys/0x00000000master/apiserver/templates/kube-apiserver.service-1.18.j2 index b7b5f14..35ae7fe 100755 --- a/sys/0x00000000master/apiserver/templates/kube-apiserver.service-1.18.j2 +++ b/sys/0x00000000master/apiserver/templates/kube-apiserver.service-1.18.j2 @@ -21,7 +21,7 @@ ExecStart=/usr/local/bin/kube-apiserver \ --enable-bootstrap-token-auth \ --token-auth-file=/etc/kubernetes/ssl/token.csv \ --service-cluster-ip-range={{service_cidr}} \ ---service-node-port-range=5000-55000 \ +--service-node-port-range=5000-32767 \ --tls-cert-file=/etc/kubernetes/ssl/kubernetes.pem \ --tls-private-key-file=/etc/kubernetes/ssl/kubernetes-key.pem \ --kubelet-client-certificate=/etc/kubernetes/ssl/kubernetes.pem \ diff --git a/sys/0x00000000master/apiserver/templates/kube-apiserver.service-1.19.j2 b/sys/0x00000000master/apiserver/templates/kube-apiserver.service-1.19.j2 index b7b5f14..35ae7fe 100755 --- a/sys/0x00000000master/apiserver/templates/kube-apiserver.service-1.19.j2 +++ b/sys/0x00000000master/apiserver/templates/kube-apiserver.service-1.19.j2 @@ -21,7 +21,7 @@ ExecStart=/usr/local/bin/kube-apiserver \ --enable-bootstrap-token-auth \ --token-auth-file=/etc/kubernetes/ssl/token.csv \ --service-cluster-ip-range={{service_cidr}} \ ---service-node-port-range=5000-55000 \ +--service-node-port-range=5000-32767 \ --tls-cert-file=/etc/kubernetes/ssl/kubernetes.pem \ --tls-private-key-file=/etc/kubernetes/ssl/kubernetes-key.pem \ --kubelet-client-certificate=/etc/kubernetes/ssl/kubernetes.pem \ diff --git a/sys/0x00000000master/apiserver/templates/kube-apiserver.service-1.20.j2 b/sys/0x00000000master/apiserver/templates/kube-apiserver.service-1.20.j2 index 23d6c2a..8f2db96 100755 --- a/sys/0x00000000master/apiserver/templates/kube-apiserver.service-1.20.j2 +++ b/sys/0x00000000master/apiserver/templates/kube-apiserver.service-1.20.j2 @@ -20,7 +20,7 @@ ExecStart=/usr/local/bin/kube-apiserver \ --enable-bootstrap-token-auth \ --token-auth-file=/etc/kubernetes/ssl/token.csv \ --service-cluster-ip-range={{service_cidr}} \ ---service-node-port-range=5000-55000 \ +--service-node-port-range=5000-32767 \ --tls-cert-file=/etc/kubernetes/ssl/kubernetes.pem \ --tls-private-key-file=/etc/kubernetes/ssl/kubernetes-key.pem \ --service-account-key-file=/etc/kubernetes/ssl/sa.pub \ diff --git a/sys/0x00000000master/apiserver/templates/kube-apiserver.service-1.21.j2 b/sys/0x00000000master/apiserver/templates/kube-apiserver.service-1.21.j2 index 23d6c2a..8f2db96 100755 --- a/sys/0x00000000master/apiserver/templates/kube-apiserver.service-1.21.j2 +++ b/sys/0x00000000master/apiserver/templates/kube-apiserver.service-1.21.j2 @@ -20,7 +20,7 @@ ExecStart=/usr/local/bin/kube-apiserver \ --enable-bootstrap-token-auth \ --token-auth-file=/etc/kubernetes/ssl/token.csv \ --service-cluster-ip-range={{service_cidr}} \ ---service-node-port-range=5000-55000 \ +--service-node-port-range=5000-32767 \ --tls-cert-file=/etc/kubernetes/ssl/kubernetes.pem \ --tls-private-key-file=/etc/kubernetes/ssl/kubernetes-key.pem \ --service-account-key-file=/etc/kubernetes/ssl/sa.pub \ diff --git a/sys/0x00000000master/apiserver/templates/kube-apiserver.service-1.22.j2 b/sys/0x00000000master/apiserver/templates/kube-apiserver.service-1.22.j2 index 3148917..57b53e3 100755 --- a/sys/0x00000000master/apiserver/templates/kube-apiserver.service-1.22.j2 +++ b/sys/0x00000000master/apiserver/templates/kube-apiserver.service-1.22.j2 @@ -18,7 +18,7 @@ ExecStart=/usr/local/bin/kube-apiserver \ --enable-bootstrap-token-auth \ --token-auth-file=/etc/kubernetes/ssl/token.csv \ --service-cluster-ip-range={{service_cidr}} \ ---service-node-port-range=5000-55000 \ +--service-node-port-range=5000-32767 \ --tls-cert-file=/etc/kubernetes/ssl/kubernetes.pem \ --tls-private-key-file=/etc/kubernetes/ssl/kubernetes-key.pem \ --service-account-key-file=/etc/kubernetes/ssl/sa.pub \ diff --git a/sys/0x00000000master/apiserver/templates/kube-apiserver.service-1.23.j2 b/sys/0x00000000master/apiserver/templates/kube-apiserver.service-1.23.j2 index 3148917..57b53e3 100755 --- a/sys/0x00000000master/apiserver/templates/kube-apiserver.service-1.23.j2 +++ b/sys/0x00000000master/apiserver/templates/kube-apiserver.service-1.23.j2 @@ -18,7 +18,7 @@ ExecStart=/usr/local/bin/kube-apiserver \ --enable-bootstrap-token-auth \ --token-auth-file=/etc/kubernetes/ssl/token.csv \ --service-cluster-ip-range={{service_cidr}} \ ---service-node-port-range=5000-55000 \ +--service-node-port-range=5000-32767 \ --tls-cert-file=/etc/kubernetes/ssl/kubernetes.pem \ --tls-private-key-file=/etc/kubernetes/ssl/kubernetes-key.pem \ --service-account-key-file=/etc/kubernetes/ssl/sa.pub \