Skip to content

[Bug] cleanup branch of misc/snapshotter/snapshotter.sh is not so good #740

Description

@wangqu123456

Problem Description

After the deploy process is completed, the sleep infinity action will create a child process to block the main process and keep the container running. If a cleanup operation is performed later, which actually involves restarting the containerd service, kubelet will disconnect from the container, causing the PreStop service to fail every time, and the forced kill signal sent by kubelet will not be received at this time.

Expected Behavior

The preStop process needs to execute successfully and restore the containerd configuration file. This will make nydus-snapshotter more robust and ensure a stable restart and recovery process.

Actual Behavior

The preStop process failed due to residual containerd configuration files and incomplete cleanup of nydus files, preventing the proper uninstallation process.

How to reproduce

  1. just deploy in k8s cluster,and then delete nydus-snapshotter,you can see files remain on the node, and error logs in kubelet logs

Environment Details

  • Nydus-snapshotter version: latest
  • Nydus version:
  • Container runtime: containerd
  • Operating System:
  • Kernel version:

Additional Information

I recommend against directly restarting containerd during the preStop process, as kubelet is much more sensitive to container connectivity at this stage than during creation. Instead, it's better to use a signal mechanism. Use trap in the deploy main process to catch the Term signal, and then restore the containerd configuration and restart it within that function.

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions