Exercise 9.2: Creating A Persistent NFS Volume (PV)
Exercise 9.2: Creating A Persistent NFS Volume (PV)
Exercise 9.2: Creating A Persistent NFS Volume (PV)
LABS 1
2. Make and populate a directory to be shared. Also give it similar permissions to /tmp/
3. Edit the NFS server file to share out the newly created directory. In this case we will share the directory with all. You can
always snoop to see the inbound request in a later step and update the file to be more narrow.
student@lfs458-node-1a0a:~$ sudo vim /etc/exports
/opt/sfw/ *(rw,sync,no_root_squash,subtree_check)
student@lfs458-worker:~$ ls -l /mnt
total 4
-rw-r--r-- 1 root root 9 Sep 28 17:55 hello.txt
6. Return to the master node and create a YAML file for the object with kind, PersistentVolume. Use the hostname
of the master server and the directory you created in the previous step. Only syntax is checked, an incorrect name
or directory will not generate an error, but a Pod using the resource will not start. Note that the accessModes do not
currently affect actual access and are typically used as labels instead.
LFS258: V 2019-08-12 © Copyright the Linux Foundation 2019. All rights reserved.
2 CHAPTER 9. VOLUMES AND DATA
PVol.yaml
1 apiVersion: v1
2 kind: PersistentVolume
3 metadata:
4 name: pvvol-1
5 spec:
6 capacity:
7 storage: 1Gi
8 accessModes:
9 - ReadWriteMany
10 persistentVolumeReclaimPolicy: Retain
11 nfs:
12 path: /opt/sfw
13 server: k8smaster #<-- Edit to match master node
14 readOnly: false
LFS258: V 2019-08-12 © Copyright the Linux Foundation 2019. All rights reserved.