Does the size of files/dirs under the volume matters when mount to a pod?

10/21/2019

I am just wondering when k8s mounts a volume to pod, does the size of the directory to mount matters or not, when I say 'matter', I mean if it will take more time with large directory.

For example, if below file1 and dir1 is very large, will it take more time?

        volumeMounts:
        - name: "config"
          mountPath: "/<existing folder>/<file1>"
          subPath: "<file1>"
        - name: "config"
          mountPath: "/<existing folder>/<dir1>"
          subPath: "<dir1>"
      restartPolicy: Always
      volumes:
        - name: "config"
          configMap:
            name: "config"
-- donglinjy
kubernetes

1 Answer

10/22/2019

The size does not matter, the 'mount' is a bind-mount which overlays and unifies multiple filesystems to a virtual view. There is no real mount happening like with external filesystems where a metadata check or even filesystem check might be performed.

You can imagine the bind mount a little bit like a symlink, so it is cheap and independent of the size.

-- Thomas
Source: StackOverflow