Is it possible to dynamically mount a volume to a kubernetes pod?

4/18/2017

My model as follows:

  • a NFS server pod (Pod A) with an empty directory volume already mounted. This volume will be served as the NFS.
  • a pod (Pod B) with a container that will access a NFS volume "/resource" when a function is run on the container.

I want Pod B to be able to mount the NFS volume from Pod A, but the problem is that Pod B is created and running before Pod A is created.

Is it possible for either:

  1. Pod B to be created & run with no volumes and then mount Pod A once Pod A is created & running
  2. Pod B to be created & run with a "dummy" NFS volume that can be reconfigured to point to Pod A once Pod A is created & running

I'm able to change my model if need be, so any help would be greatly appreciated.

-- emersonwood
kubernetes

1 Answer

4/19/2017

That's not possible with kubernetes concepts.

If you really really want you could run your pod in privileged mode and issue the mount commands from your app. I do not recommend this.

-- Janos Lenart
Source: StackOverflow