Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
Kubernetes Service not working with NFS between two pods #74266
What happened: Due to what I can only assume is an issue with K8s Services, I'm unable to mount a NFS share from a server pod to a client pod
What you expected to happen:
How to reproduce it (as minimally and precisely as possible):
When I try to mount
First I created a GCP Disk to mount as a PV
This produces the following
I can successfully mount the /exports from localhost on the nfs-server.
After this, I run a temporary container just to test with the following command
When I try to mount the nfs inside the debug container (in the same cluster) I get the following error
^^^^ This is the issue I'm trying to solve
Curiously, I'm able to use the nfs server as a PV and PVC. To demonstrate, the following yaml deploys and can be used successfully
This can then be proven and tested with the following ReplicationController
All of this leads me to believe that there is something going on with Services that (my best guess) drops low port numbers, like rpc.
Anything else we need to know?: I understand this could be better asked in StackOverflow, but I have tried to find answers elsewhere to no avail. This is a last ditch effort to get an answer.
I don't think this is a bug.
NFS doesn't allow you to nested export filesystem.
The container mounts host-based path to /exportfs, then export /exportfs path inside container.
It is same as following scenario.
@YoubingLi Thank you for that explanation! best answer I've gotten by far.
I'm curious now, why is it that I can use that share as a Persistent Volume then? What is the difference between me mounting the nfs inside a container, and K8s service mounting that same nfs share internally to create a PV/PVC? Also why am I able to mount the same nfs share when I mount through
There seems to be something special creating a nfs PV/PVC (as in the config I shared above) is doing that I can't replicate when just trying to mount inside another pod.
There really is not anything special about how volumes are mounted directly withing a Pod vs through a PVC.
to debug, here's what I would try:
This does not seem like a network issue at all, and I doubt very much it is a bug in Kubernetes. If you have evidence otherwise, PLEASE reopen and I will dig deeper.
@CodeCorrupt I deleted my previous comment, my service was defined incorrectly. My issue was not related to this topic.
(for the volume, you can use whatever, I just have been using a GCP disk)
From within the debug container, you should be able to mount the NFS dir. (Assuming you have the NFS server itself configured to export the correct folder/volume)