Is there a way to list files on host from within kubernetes pod?

3/29/2020

Hello I'm trying to create a containerized file-system management tool.

Is there a way I can list files on my host nodes file-system from within my pod/container?

-- A. Campagna
containers
docker
kubernetes
pod
python

1 Answer

3/29/2020

Yes, if you have a volumeMount pointing to the hostPath: volume, although I can't say with high certainty it will do the right thing with regard to other bind mounts on the host:

spec:
  containers:
  - name: looker
    volumeMounts:
    - name: host
      mountPath: /host-fs

  volumes:
  - name: host
    hostPath:
      path: /
-- mdaniel
Source: StackOverflow