前置須知:
在本次實驗環境中,
mount path:/coco
首先需要在資料集要放置的主機 ( MasterNode )安裝 NFS 套件,
sudo apt update
sudo apt install nfs-kernel-server
並且編輯 NFS 伺服器的設定檔 /etc/exports,將資料夾添加到共享列表中。
sudo nano /etc/exports
/coco/ *(rw,sync,no_subtree_check)
然後把要共享的 path 輸入進去如下圖所示,
再來儲存並關閉檔案,然後重新載入 NFS 伺服器的設定,並且重新啟動。
sudo exportfs -ra
sudo systemctl start nfs-kernel-server
安裝客戶端的套件就可以了。
sudo apt update
sudo apt install nfs-common
apiVersion: v1
kind: PersistentVolume
metadata:
name: yolov7-pv
spec:
capacity:
storage: 30Gi
accessModes:
- ReadWriteMany
nfs:
# <mount-path-ip>
server: 10.20.1.5
path: /coco
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: yolov7-pvc
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 30Gi
selector:
matchLabels:
app: yolov7-pv
volumeName: yolov7-pv