Kubernetes (1.10) mountPropagation: Bidirectional not working.

5/25/2018

I'm creating a pod with a volumeMount set to mountPropagation: Bidirectional. When created, the container is mounting the volume with "Propagation": "rprivate".

From the k8s docs I would expect mountPropagation: Bidirectional to result in a volume mount propagation of rshared

If I start the container directly with docker this is working.

Some info:

Deployment Yaml

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: test
spec:
  selector:
    matchLabels:
      app: test
  strategy:
    type: RollingUpdate
  template:
    metadata:
      labels:
        app: test
    spec:
      containers:
      - image: gcr.io/google_containers/busybox:1.24
        command:
          - sleep
          - "36000"
        name: test
        volumeMounts:
        - mountPath: /tmp/test
          mountPropagation: Bidirectional
          name: test-vol
      volumes:
      - name: test-vol
        hostPath:
          path: /tmp/test

Resulting mount section from docker inspect

"Mounts": [
            {
                "Type": "bind",
                "Source": "/tmp/test",
                "Destination": "/tmp/test",
                "Mode": "",
                "RW": true,
                "Propagation": "rprivate"
            }…..

Equivalent Docker run

docker run --restart=always --name test -d --net=host --privileged=true -v /tmp/test:/tmp/test:shared gcr.io/google_containers/busybox:1.24

Resulting Mounts section from docker inspect when created with docker run

"Mounts": [
            {
                "Type": "bind",
                "Source": "/tmp/test",
                "Destination": "/tmp/test",
                "Mode": "shared",
                "RW": true,
                "Propagation": "shared"
            }...

Output of kubectl version

Client Version: version.Info{Major:"1", Minor:"10", GitVersion:"v1.10.1", GitCommit:"d4ab47518836c750f9949b9e0d387f20fb92260b", GitTreeState:"clean", BuildDate:"2018-04-13T22:29:03Z", GoVersion:"go1.9.5", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"10", GitVersion:"v1.10.1", GitCommit:"d4ab47518836c750f9949b9e0d387f20fb92260b", GitTreeState:"clean", BuildDate:"2018-04-12T14:14:26Z", GoVersion:"go1.9.3", Compiler:"gc", Platform:"linux/amd64"}

Using rke version v0.1.6

-- Will
docker
kubernetes
rke

1 Answer

5/25/2018

this was a regression fixed in 1.10.3 in https://github.com/kubernetes/kubernetes/pull/62633

-- Jordan Liggitt
Source: StackOverflow