ubuntu in ~ at k8s-node1 via 🐍 3.8.6 ➜ sudo mkdir /var/nfs/general -p # 创建目录
ubuntu in ~ at k8s-node1 via 🐍 3.8.6 ➜ ls -la /var/nfs/general total 8 drwxr-xr-x 2 root root 4096 Oct 1513:41 . drwxr-xr-x 3 root root 4096 Oct 1513:41 ..
ubuntu in ~ at k8s-node1 via 🐍 3.8.6 ➜ sudo chown nobody:nogroup /var/nfs/general
Step 3 - Configuring the NFS Exports on the Host Server
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
chyi in ~ at k8s-master ➜ sudo vim /etc/exports # This fileis auto-generated by openmediavault (https://www.openmediavault.org) # WARNING: Do not edit this file, your changes will get lost.
# /etc/exports: the access control listfor filesystems which may be exported # to NFS clients. See exports(5). /export/K8sData 172.30.1.0/24(fsid=2,rw,subtree_check,insecure) - rw: 此选项为客户端计算机提供对卷的读写访问权限 - sync: 此选项强制NFS在响应恢复之前将更改写入磁盘,会导致更稳定和一致的环境,因为恢复响应远程卷的世纪状态,但是他也降低了文件操作的速度. - no_subtree_check: 此选项防止子树检查,这是一个过程,主机必须检查该文件是否在每个请求的导出树中实际上仍然可用,在客户端打开文件和重命名文件时 - no_root_squash: 默认情况下,NFS将来自root用户的远程请求转换为服务器上的非特权用户,这是为了防止客户端上的root账户以root身份使用主机的文件系统的安全功能
$ sudo systemctl restart nfs-kernel-server
Step 4 - Create Mount Points and Mount Directories on the Client