1、安装和设置开机启动
#安装
yum install nfs-utils
#设置开机启动
systemctl enable rpcbind
systemctl enable nfs
#启动 NFS 服务
systemctl start rpcbind
systemctl start nfs
备注:因为我的防火墙是隔壁的,不需要打开
2、配置
vim /etc/exports
/home/nfs/data *(rw,sync,no_root_squash,no_all_squash)
mkdir -p /home/nfs/data
systemctl restart nfs
/home/nfs/data: 共享目录位置。
192.168.0.0/24: 客户端 IP 范围,* 代表所有,即没有限制。
rw: 权限设置,可读可写。
sync: 同步共享目录。
no_root_squash: 可以使用 root 授权。
no_all_squash: 可以使用普通用户授权。
:wq 保存设置之后,重启 NFS 服务。
3、k8s 所有节点安装nfs
#安装
yum install -y nfs-utils