Fix pods stuck terminating.

If the kubelet container is restarted on a host (during upgrades, or manually)
the bind mounts duplicate into /rootfs and kubelet cannot unmount these.

This leads to stuck terminating pods that must be resolved with either --force
or restart of kubelet container.

Adding 'rslave' means that when the kubelet unmounts volumes at /var/lib/kubelet/pods
this propogates to the host (using 'rshared'), and back into the container in /rootfs.

This bug was likely introduced when mounting of /rootfs was added[0].

[0] 1994e9448a

Change-Id: I44f80ccc97c0eeab98f1edbe4a22763732b7f4da
This commit is contained in:
Dale Smith 2022-09-14 17:07:41 +12:00 committed by Dale Smith
parent 206a817cf7
commit b318560b59
2 changed files with 2 additions and 2 deletions

View File

@ -187,7 +187,7 @@ ExecStart=/bin/bash -c '/usr/bin/podman run --name kubelet \\
--pid host \\
--network host \\
--entrypoint /hyperkube \\
--volume /:/rootfs:ro \\
--volume /:/rootfs:rslave,ro \\
--volume /etc/cni/net.d:/etc/cni/net.d:ro,z \\
--volume /etc/kubernetes:/etc/kubernetes:ro,z \\
--volume /usr/lib/os-release:/usr/lib/os-release:ro \\

View File

@ -85,7 +85,7 @@ ExecStart=/bin/bash -c '/usr/bin/podman run --name kubelet \\
--pid host \\
--network host \\
--entrypoint /hyperkube \\
--volume /:/rootfs:ro \\
--volume /:/rootfs:rslave,ro \\
--volume /etc/cni/net.d:/etc/cni/net.d:ro,z \\
--volume /etc/kubernetes:/etc/kubernetes:ro,z \\
--volume /usr/lib/os-release:/usr/lib/os-release:ro \\