Kubernetes: Is it possible to mount a fileshare located in the master node into a pod / container on a worker node?

4/30/2020

I've been trying since weeks to figure this out, but I cannot find a proper answer to this situation.

I have a master node, let's call it "Master Node A" and I also have some worker nodes, let's call them "Worker Node A", "Worker Node B" and "Worker Node C".

I am able to schedule jobs from my Master Node A over to my worker nodes which is good. Now to my specific situation, I cannot find an answer to it and I don't know if it is possible to do this in Kubernetes:

On the Master Node A I have a fileshare mounted in "/data", with some data in it. Now I want that all my containers, when they are created / scheduled and running, have a mount in "/mnt/data" which refers to the Master Node A fileshare folder "/data".

So no matter in which worker node the pod / container is, it should have access to the data located in the Master Node A in "/data" and of course being able to write into it.

Is this even possible in Kubernetes? I also wouldn't mind to create multiple directories on the master node ("data-01", "data-02", "data-03", ...) which all are mounted to the same fileshare and in which every pod would mount one of these folders (I would that manage somehow in the future, no worries).

Unfortunately in my situation I cannot mount the fileshare directly into the worker nodes, since the next step would be to add fileshare user authentification with Linux UID, so that only specific users have access to some directories but also are allowed to write something in a specific location, but this should all be done on the Master Node A.

Do you think that this can be done somehow? If so, what do I need to do to achieve that?

-- TheHeroOfTime
kubernetes

0 Answers