Can pods mount NFS volume?

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

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: 


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, 2019 by Sirajul
• 55,420 points

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

Set volume mount user group and file permissions in kubernetes

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

answered Jan 16, 2019 in Kubernetes by ajs3033
• 7,280 points
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, 2019 in Kubernetes by Sirajul
• 55,420 points
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, 2019 in Others by anonymous
+4 votes
1 answer

Installing Web UI (Dashboard):kubernetes-dashboard on main Ubuntu 16.04.6 LTS (Xenial Xerus) server

Follow these steps: $ kubeadm reset $ kubeadm init ...READ MORE

answered Apr 11, 2019 in Kubernetes by Kalgi
• 51,890 points

reshown Apr 12, 2019 by Kalgi 2,229 views
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, 2019 in Kubernetes by Sirajul
• 55,420 points
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, 2019 in Kubernetes by Sirajul
• 55,420 points