rancher / elemental-toolkit

:snowflake: The toolkit to build, ship and maintain cloud-init driven Linux derivatives based on container images
https://rancher.github.io/elemental-toolkit/docs/
Apache License 2.0
289 stars 49 forks source link

Influence bind persistent mounts PROPAGATION #2042

Open anmazzotti opened 5 months ago

anmazzotti commented 5 months ago

Is your feature request related to a problem? Please describe.

In a kubeadm-elemental system, /var/lib/kubelet needs to be persistent. When this path is defined in the PERSISTENT_STATE_PATHS list, and PERSISTENT_STATE_BIND: "true" is also defined, then a private bind mount is created.

However kubelet will also create a shared one, and complain about the private:

Error:

Error: failed to generate container "1ad6983bbfbb37f08ddfd56a7ca3f0e72c61bf277b21cc05dd1e1c657eb55536" spec: failed to generate spec: path "/var/lib/kubelet" is mounted on "/var/lib/kubelet" but it is not a shared mount

State:

findmnt -o TARGET,PROPAGATION /var/lib/kubelet/
TARGET           PROPAGATION
/var/lib/kubelet private
/var/lib/kubelet shared

Describe the solution you'd like I'd like to influence the propagation, maybe something like:

PERSISTENT_STATE_BIND: "shared"

Describe alternatives you've considered As a workaround, /var/lib can be defined as persistent instead. This however is sub-optimal has it has a wide scope.

Another option is to remove PERSISTENT_STATE_BIND and use overlay mounts, however this does not work as well out of the box with containerd, which is also a dependency in this setup.