Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

My bin directory was deleted by installContainerdMoudle #2143

Closed
deqingLv opened this issue Feb 23, 2024 · 0 comments · Fixed by #2144
Closed

My bin directory was deleted by installContainerdMoudle #2143

deqingLv opened this issue Feb 23, 2024 · 0 comments · Fixed by #2144
Labels
bug Something isn't working

Comments

@deqingLv
Copy link
Contributor

What is version of KubeKey has the issue?

v3.1.0-alpha.8

What is your os environment?

any environment

KubeKey config file

Offline installation use containerd runtime.

A clear and concise description of what happend.

I have my own bin directory at /root/.
After kk create cluster , /root/bin was deleted.

I figouted out the cause is SyncContainerd action below:

func (s *SyncContainerd) Execute(runtime connector.Runtime) error {
	if err := utils.ResetTmpDir(runtime); err != nil {
		return err
	}

	binariesMapObj, ok := s.PipelineCache.Get(common.KubeBinaries + "-" + runtime.RemoteHost().GetArch())
	if !ok {
		return errors.New("get KubeBinary by pipeline cache failed")
	}
	binariesMap := binariesMapObj.(map[string]*files.KubeBinary)

	containerd, ok := binariesMap[common.Containerd]
	if !ok {
		return errors.New("get KubeBinary key containerd by pipeline cache failed")
	}

	dst := filepath.Join(common.TmpDir, containerd.FileName)
	if err := runtime.GetRunner().Scp(containerd.Path(), dst); err != nil {
		return errors.Wrap(errors.WithStack(err), fmt.Sprintf("sync containerd binaries failed"))
	}

	if _, err := runtime.GetRunner().SudoCmd(
		fmt.Sprintf("mkdir -p /usr/bin && tar -zxf %s && mv bin/* /usr/bin && rm -rf bin", dst),
		false); err != nil {
		return errors.Wrap(errors.WithStack(err), fmt.Sprintf("install containerd binaries failed"))
	}
	return nil
}

Relevant log output

No response

Additional information

No response

@deqingLv deqingLv added the bug Something isn't working label Feb 23, 2024
deqingLv added a commit to yushanyulin/kubekey that referenced this issue Feb 25, 2024
deqingLv added a commit to yushanyulin/kubekey that referenced this issue Feb 25, 2024
ks-ci-bot added a commit that referenced this issue Feb 26, 2024
…after_install_container

fix #2143: My bin directory was deleted by installContainerdMoudle
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant