kubernetes: HostPath mounts failing with "Path is not a shared or slave mount"
Is this a BUG REPORT or FEATURE REQUEST?: /kind bug
What happened: After upgrading from v1.9.2 -> v1.10.0-beta.2, containers using hostpath mounts are failing with:
exitCode: 128
finishedAt: 2018-03-12T19:25:03Z
message: 'linux mounts: Path /opt/kubelet/dev is mounted on / but it is not
a shared or slave mount.'
reason: ContainerCannotRun
startedAt: 2018-03-12T19:25:03Z
The message linux mounts: Path /opt/kubelet/dev is mounted on / but it is not a shared or slave mount seems like it’s from the docker daemon, but the docker daemon was not updated during the upgrade so I had assumed a behaviour in the kubelet had changed that would cause this.
What you expected to happen:
Pod should be running as usual, but it fails with RunContainerError.
How to reproduce it (as minimally and precisely as possible): Run Kubernetes cluster using host path mount.
Anything else we need to know?:
Environment:
- Kubernetes version (use
kubectl version):
$ kubectl version
Client Version: version.Info{Major:"1", Minor:"9", GitVersion:"v1.9.0", GitCommit:"925c127ec6b946659ad0fd596fa959be43f0cc05", GitTreeState:"clean", BuildDate:"2017-12-15T21:07:38Z", GoVersion:"go1.9.2", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"10+", GitVersion:"v1.10.0-beta.2", GitCommit:"63dad40a0391b7af32c34fdbf41fa199c3b247ad", GitTreeState:"clean", BuildDate:"2018-03-07T20:30:35Z", GoVersion:"go1.9.3", Compiler:"gc", Platform:"linux/amd64"}
- Cloud provider or hardware configuration:
- OS (e.g. from /etc/os-release): Ubuntu
- Kernel (e.g.
uname -a): - Install tools:
- Others:
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 26 (21 by maintainers)
Commits related to this issue
- Merge pull request #60811 from dims/configure-shared-mount-to-avoid-conformance-test-failure Automatic merge from submit-queue (batch tested with PRs 60980, 61273, 60811, 61021, 61367). If you want t... — committed to kubernetes/kubernetes by deleted user 6 years ago
- travis: Add workaround for Kube 1.10 Works around https://github.com/kubernetes/kubernetes/issues/61058 Signed-off-by: Fabian Deutsch <fabiand@fedoraproject.org> — committed to fabiand/kubevirt-demo by fabiand 6 years ago
- mount --make-rshared required on travis see https://github.com/kubernetes/kubernetes/issues/61058#issuecomment-372764783 — committed to minrk/binderhub by minrk 6 years ago
- mount --make-rshared required on travis for kube 1.10 see https://github.com/kubernetes/kubernetes/issues/61058#issuecomment-372764783 — committed to minrk/binderhub by minrk 6 years ago
- mount --make-rshared required on travis for kube 1.10 see https://github.com/kubernetes/kubernetes/issues/61058#issuecomment-372764783 — committed to minrk/binderhub by minrk 6 years ago
- mount --make-rshared required on travis for kube 1.10 see https://github.com/kubernetes/kubernetes/issues/61058#issuecomment-372764783 — committed to minrk/binderhub by minrk 6 years ago
- mount --make-rshared required on travis for kube 1.10 see https://github.com/kubernetes/kubernetes/issues/61058#issuecomment-372764783 — committed to gesiscss/binderhub by minrk 6 years ago
- mount --make-rshared required on travis for kube 1.10 see https://github.com/kubernetes/kubernetes/issues/61058#issuecomment-372764783 — committed to gesiscss/binderhub by minrk 6 years ago
Heh, good old Ubuntu… Kubernetes expects that it runs with
/(or whatever holds the hostpaths that you want to use in pods) with rshared mount propagation. systemd does that during boot automatically, on other distros you need to add a new service or add a command to Kubernetes init script before running Docker:This should be enough for Docker to work.
I hope it’s documented somewhere when 1.10 ships.
I have the same problem on Mac (works like a charm on Ubuntu).
$ docker -v Docker version 20.10.2, build 2291f61
ricc@macbookpro:~/prometheus-node-exporter$🐼 docker run -it --net=“host” --pid=“host” -v “/:/host:ro,rslave” prom/node-exporter:latest --path.rootfs=/host docker: Error response from daemon: path / is mounted on / but it is not a shared or slave mount. ERRO[0000] error waiting for container: context canceled
Disabling the MountPropagation feature fixes the issue
Thanks @jsafrane for the update, it should definitely be included in the
Action Requiredsection of the CHANGELOG