mirror of
https://github.com/kubesphere/kubekey.git
synced 2025-12-26 01:22:51 +00:00
stop kubelet first when remove worker node.
This commit is contained in:
parent
caeaff8a88
commit
abf5b0dc8f
|
|
@ -103,6 +103,15 @@ type ClearNodeOSModule struct {
|
|||
func (c *ClearNodeOSModule) Init() {
|
||||
c.Name = "ClearNodeOSModule"
|
||||
|
||||
stopKubelet := &task.RemoteTask{
|
||||
Name: "StopKubelet",
|
||||
Desc: "Stop Kubelet",
|
||||
Hosts: c.Runtime.GetHostsByRole(common.Worker),
|
||||
Prepare: new(DeleteNode),
|
||||
Action: new(StopKubelet),
|
||||
Parallel: true,
|
||||
}
|
||||
|
||||
resetNetworkConfig := &task.RemoteTask{
|
||||
Name: "ResetNetworkConfig",
|
||||
Desc: "Reset os network config",
|
||||
|
|
@ -131,6 +140,7 @@ func (c *ClearNodeOSModule) Init() {
|
|||
}
|
||||
|
||||
c.Tasks = []task.Interface{
|
||||
stopKubelet,
|
||||
resetNetworkConfig,
|
||||
removeFiles,
|
||||
daemonReload,
|
||||
|
|
|
|||
|
|
@ -197,6 +197,15 @@ func (r *ResetNetworkConfig) Execute(runtime connector.Runtime) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
type StopKubelet struct {
|
||||
common.KubeAction
|
||||
}
|
||||
|
||||
func (s *StopKubelet) Execute(runtime connector.Runtime) error {
|
||||
_, _ = runtime.GetRunner().SudoCmd("systemctl disable kubelet && systemctl stop kubelet && exit 0", false)
|
||||
return nil
|
||||
}
|
||||
|
||||
type UninstallETCD struct {
|
||||
common.KubeAction
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue