Skip to content

Instantly share code, notes, and snippets.

Created October 22, 2018 00:56
  • Star 7 You must be signed in to star a gist
  • Fork 6 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save matthewpalmer/0f213028473546b14fd75b7ebf801115 to your computer and use it in GitHub Desktop.
Example for NFS server in Kubernetes
# Note - an NFS server isn't really a Kubernetes
# concept. We're just creating it in Kubernetes
# for illustration and convenience. In practice,
# it might be run in some other system.
# Create a service to expose the NFS server
# to pods inside the cluster.
kind: Service
apiVersion: v1
name: nfs-service
role: nfs
# Open the ports required by the NFS server
# Port 2049 for TCP
- name: tcp-2049
port: 2049
protocol: TCP
# Port 111 for UDP
- name: udp-111
port: 111
protocol: UDP
# Run the NFS server image in a pod that is
# exposed by the service.
kind: Pod
apiVersion: v1
name: nfs-server-pod
role: nfs
- name: nfs-server-container
image: cpuguy83/nfs-server
privileged: true
# Pass the paths to share to the Docker image
- /exports
Copy link

Hi matthewpalmer I am trying to use the same and getting connection timeout when pod(nfs client) is coming up.
Error :- Warning FailedMount 1m kubelet, clm-pun-tk241m MountVolume.SetUp failed for volume "nfs-volume" : mount failed: exit status 32
Mounting command: systemd-run
Mounting arguments: --description=Kubernetes transient mount for /var/lib/kubelet/pods/e3442a8a-817a-11e9-9d55-0050568f2124/volumes/kubernetes.ionfs/nfs-volume --scope -- mount -t nfs /var/lib/kubelet/pods/e3442a8a-817a-11e9-9d55-0050568f2124/volumes/kubernetes.ionfs/nfs-volume
Output: Running scope as unit run-r08b08dfe7730459d8ab7ac2ef308e7bc.scope.
mount.nfs: Connection timed out
Warning FailedMount 48s (x7 over 14m) kubelet, clm-pun-tk241m Unable to mount volumes for pod "pod-using-nfs_default(e3442a8a-817a-11e9-9d55-0050568f2124)": timeout expired waiting for volumes to attach or mount for pod "default"/"pod-using-nfs". list of unmounted volumes=[nfs-volume]. list of unattached volumes=[nfs-volume default-token-vjdn5]

Copy link

Same here: can replicate the use case described by poster above.

Copy link

Turns out you need to configure quotad and other services to use static ports. You can modify the docker image via RUN add echo "....." statements (plus the "non-kernel" setup flags), and then make the appropriate port entries in your service's yaml definition, and it works perfectly!

Copy link

Benkler commented Jun 6, 2020

Could you please specify what you have done exactly? I run into the same problem and I am not able to solve it.

Copy link

I came across this article while looking more into this issues but iam confused as of now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment