From bfb7cfb47f6f6eff20cb88679ff010a8722544ea Mon Sep 17 00:00:00 2001 From: Timo Derstappen Date: Tue, 15 Sep 2026 23:44:30 +0200 Subject: [PATCH] atelet: mount /var/lib/kubelet/plugins with HostToContainer propagation atelet hostPath-mounts /var/lib/kubelet/plugins to reach the CSI driver sockets. With the default (private) propagation every atelet start copies the node's CSI globalmounts into the container's mount namespace, and kubelet's later unmount of a volume does not reach that copy: the volume's filesystem stays mounted there, the block device (and the LUKS mapper of an encrypted volume) stays open, and the volume can never be unstaged while atelet runs. Observed with Longhorn: NodeUnstageVolume failed forever with "cryptsetup luksClose: Device is still in use" after a pod moved to another node, and the pod could not attach the volume on the new node until atelet was restarted. CSI node plugins use HostToContainer (rslave) for the kubelet directories: mounts and unmounts made by kubelet propagate into the container, and nothing propagates back. Signed-off-by: Timo Derstappen --- charts/substrate-atelet/templates/atelet.yaml | 4 +++ .../tests/kubelet_plugins_test.yaml | 29 +++++++++++++++++++ charts/substrate/templates/atelet.yaml | 4 +++ manifests/ate-install/atelet.yaml | 4 +++ 4 files changed, 41 insertions(+) create mode 100644 charts/substrate-atelet/tests/kubelet_plugins_test.yaml diff --git a/charts/substrate-atelet/templates/atelet.yaml b/charts/substrate-atelet/templates/atelet.yaml index 66c8e3a4ce..ca13651e92 100644 --- a/charts/substrate-atelet/templates/atelet.yaml +++ b/charts/substrate-atelet/templates/atelet.yaml @@ -294,6 +294,10 @@ spec: readOnly: true - name: kubelet-plugins mountPath: /var/lib/kubelet/plugins + # HostToContainer: kubelet stages CSI volumes under this directory; a private copy + # of those mounts would keep every volume's filesystem (and LUKS mapper) open after + # kubelet unmounts it, so the volume can never be unstaged while atelet runs. + mountPropagation: HostToContainer - name: device-plugins mountPath: /var/lib/kubelet/device-plugins - name: host-dev diff --git a/charts/substrate-atelet/tests/kubelet_plugins_test.yaml b/charts/substrate-atelet/tests/kubelet_plugins_test.yaml new file mode 100644 index 0000000000..611f2e201c --- /dev/null +++ b/charts/substrate-atelet/tests/kubelet_plugins_test.yaml @@ -0,0 +1,29 @@ +# Copyright 2026 The Agent Substrate Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +suite: Kubelet plugins mount +templates: +- atelet.yaml +tests: +- it: receives kubelet's mounts and unmounts of CSI volumes + documentSelector: + path: kind + value: DaemonSet + asserts: + - contains: + path: spec.template.spec.containers[?(@.name == "atelet")].volumeMounts + content: + name: kubelet-plugins + mountPath: /var/lib/kubelet/plugins + mountPropagation: HostToContainer diff --git a/charts/substrate/templates/atelet.yaml b/charts/substrate/templates/atelet.yaml index 6c55ffa5ed..d6ba49f9a2 100644 --- a/charts/substrate/templates/atelet.yaml +++ b/charts/substrate/templates/atelet.yaml @@ -295,6 +295,10 @@ spec: readOnly: true - name: kubelet-plugins mountPath: /var/lib/kubelet/plugins + # HostToContainer: kubelet stages CSI volumes under this directory; a private copy + # of those mounts would keep every volume's filesystem (and LUKS mapper) open after + # kubelet unmounts it, so the volume can never be unstaged while atelet runs. + mountPropagation: HostToContainer - name: device-plugins mountPath: /var/lib/kubelet/device-plugins - name: host-dev diff --git a/manifests/ate-install/atelet.yaml b/manifests/ate-install/atelet.yaml index 7036665b2a..1d18a9dd00 100644 --- a/manifests/ate-install/atelet.yaml +++ b/manifests/ate-install/atelet.yaml @@ -372,6 +372,10 @@ spec: readOnly: true - name: kubelet-plugins mountPath: /var/lib/kubelet/plugins + # HostToContainer: kubelet stages CSI volumes under this directory; a private copy + # of those mounts would keep every volume's filesystem (and LUKS mapper) open after + # kubelet unmounts it, so the volume can never be unstaged while atelet runs. + mountPropagation: HostToContainer - name: device-plugins mountPath: /var/lib/kubelet/device-plugins - name: host-dev