k8s nfs 安装流程
2020年2月3日大约 1 分钟
nfs
NFS(Network File System)是一种用于在网络上共享文件系统的协议。它允许不同的计算机系统之间通过网络共享文件和目录,使得用户可以像访问本地文件一样访问远程系统上的文件。
安装流程
- 安装配置 nfs
yum -y install nfs-utils rpcbind
- 共享目录设置权限
chmod 755 /data/k8s/
- 配置 nfs, nfs 的默认配置文件在
/etc/exports
文件下,在该文件中添加下面的配置信息
/data/nfs-share *(rw,async,no_root_squash)
- 启动服务 nfs 需要向 rpc 注册,rpc 一旦重启了,注册的文件都会丢失,向他注册的服务都需要重启
注意启动顺序,先启动 rpcbind
$ systemctl start rpcbind.service
$ systemctl enable rpcbind
$ systemctl status rpcbind
然后启动 nfs 服务
$ systemctl start nfs.service
$ systemctl enable nfs
$ systemctl status nfs
同样看到 Started 则证明 NFS Server 启动成功了。 另外我们还可以通过下面的命令确认下:
$ rpcinfo -p|grep nfs
100003 3 tcp 2049 nfs
100003 4 tcp 2049 nfs
100227 3 tcp 2049 nfs_acl
100003 3 udp 2049 nfs
100003 4 udp 2049 nfs
100227 3 udp 2049 nfs_acl
查看具体目录挂载权限
$ cat /var/lib/nfs/etab
原创声明
平台文章均为原创文章,未经许可,禁止转载。
如需转载,请联系作者获取授权,并注明来源及原文链接。