Created
October 22, 2018 00:56
-
-
Save matthewpalmer/0f213028473546b14fd75b7ebf801115 to your computer and use it in GitHub Desktop.
Example for NFS server in Kubernetes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 | |
metadata: | |
name: nfs-service | |
spec: | |
selector: | |
role: nfs | |
ports: | |
# 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 | |
metadata: | |
name: nfs-server-pod | |
labels: | |
role: nfs | |
spec: | |
containers: | |
- name: nfs-server-container | |
image: cpuguy83/nfs-server | |
securityContext: | |
privileged: true | |
args: | |
# Pass the paths to share to the Docker image | |
- /exports |
Same here: can replicate the use case described by poster above.
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!
Could you please specify what you have done exactly? I run into the same problem and I am not able to solve it.
I came across this article while looking more into this issues but iam confused as of now https://redblink.com/setup-nfs-server-provisioner-kubernetes/
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.io
nfs/nfs-volume --scope -- mount -t nfs 192.168.93.230:/ /var/lib/kubelet/pods/e3442a8a-817a-11e9-9d55-0050568f2124/volumes/kubernetes.ionfs/nfs-volumeOutput: 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]