Unverified Commit 6ad67eb9 authored by cuisongliu's avatar cuisongliu Committed by GitHub
Browse files

Merge pull request #370 from cuisongliu/fix/delete_master

feat(develop): 修复由于kubectl出现的问题导致无法delete node
Showing with 7 additions and 0 deletions
+7 -0
......@@ -66,6 +66,7 @@ func init() {
cleanCmd.Flags().StringSliceVar(&install.MasterIPs, "master", []string{}, "clean master ips.kubernetes multi-nodes ex. 192.168.0.5-192.168.0.5")
cleanCmd.PersistentFlags().BoolVarP(&install.CleanForce, "force", "f", false, "if this is true, will no prompt")
cleanCmd.PersistentFlags().BoolVar(&install.CleanAll, "all", false, "if this is true, delete all ")
cleanCmd.Flags().IntVar(&install.Vlog, "vlog", 0, "kubeadm log level")
// Cobra supports Persistent Flags which will work for this command
// and all subcommands, e.g.:
......
......@@ -54,4 +54,5 @@ func init() {
rootCmd.AddCommand(joinCmd)
joinCmd.Flags().StringSliceVar(&install.MasterIPs, "master", []string{}, "kubernetes multi-master ex. 192.168.0.5-192.168.0.5")
joinCmd.Flags().StringSliceVar(&install.NodeIPs, "node", []string{}, "kubernetes multi-nodes ex. 192.168.0.5-192.168.0.5")
joinCmd.Flags().IntVar(&install.Vlog, "vlog", 0, "kubeadm log level")
}
......@@ -153,6 +153,8 @@ func (s *SealosClean) cleanMaster(master string) {
func clean(host string) {
cmd := "kubeadm reset -f " + vlogToStr()
_ = SSHConfig.CmdAsync(host, cmd)
cmd = fmt.Sprintf("sed -i \"/%s/d\" /root/.bashrc ", "kubectl")
_ = SSHConfig.CmdAsync(host, cmd)
cmd = "modprobe -r ipip && lsmod"
_ = SSHConfig.CmdAsync(host, cmd)
cmd = "rm -rf ~/.kube/ && rm -rf /etc/kubernetes/"
......
......@@ -9,6 +9,9 @@ import (
func (s *SealosInstaller) SendPackage() {
pkg := path.Base(PkgUrl)
kubeHook := fmt.Sprintf("cd /root && rm -rf kube && tar zxvf %s && cd /root/kube/shell && sh init.sh", pkg)
deletekubectl := fmt.Sprintf("sed -i \"/%s/d\" /root/.bashrc ", "kubectl")
completion := "echo 'source <(kubectl completion bash)' >> /root/.bashrc && source /root/.bashrc"
kubeHook = kubeHook + " && " + deletekubectl + " && " + completion
PkgUrl = SendPackage(PkgUrl, s.Hosts, "/root", nil, &kubeHook)
//send sealos
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment