Can pods mount NFS volume?

+1 vote
Can a Kubernetes-pod mount an NFS volume?
Jul 15 in Kubernetes by Jenny
424 views

1 answer to this question.

+1 vote

Yes, there's an example here of both an NFS client and server running within pods in the cluster: 

Example: 

Configuring NFS Server

Define NFS server pod and NFS service:

$ kubectl create -f nfs-server-pod.yaml
$ kubectl create -f nfs-server-service.yaml

The server exports /mnt/data directory, which contains dummy index.html. Wait until the pod is running!

Configuring NFS Client

See WEB server pod, which runs a simple web server serving data from the NFS. 

The pod assumes your DNS is set up and the NFS service is reachable as nfs-server.default.kube.local

Edit the yaml file to supply another name or directly its IP address (use kubectl get services to get it).

Finally, define the pod:

$ kubectl create -f web-pod.yaml
Now the pod serves index.html from the NFS server:
$ curl http://<the container IP address>/
Hello World!
answered Jul 15 by Sirajul
• 40,980 points
Hi,

Do you know where the YAMLs files about the exemple above is ?
You have to configure those yaml files on the NFS server within the /volumes/nfs directory structure of your kubernetes cluster.

Related Questions In Kubernetes

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

Set volume mount user group and file permissions in kubernetes

There's a setting in Pod Security Context ...READ MORE

answered Jan 16 in Kubernetes by ajs3033
• 7,280 points
2,989 views
0 votes
1 answer

Kubernetes: Can we use multiple claims out of a persistent volume?

The mapping between persistentVolume and persistentVolumeClaim is ...READ MORE

answered Jul 16 in Kubernetes by Sirajul
• 40,980 points
39 views
0 votes
1 answer
0 votes
3 answers

Error while joining cluster with node

Hi Kalgi after following above steps it ...READ MORE

answered Jan 17 in Others by anonymous
3,390 views
+3 votes
1 answer
0 votes
1 answer

How can i get all the pods on a node?

You can use the following command to ...READ MORE

answered Jul 12 in Kubernetes by Sirajul
• 40,980 points
44 views
0 votes
1 answer

how can we prioritize pods and preempt them?

A PriorityClass is a non-namespaced object that ...READ MORE

answered Jul 15 in Kubernetes by Sirajul
• 40,980 points
99 views