1、安装和设置开机启动


  1. #安装
  2. yum install nfs-utils
  3. #设置开机启动
  4. systemctl enable rpcbind
  5. systemctl enable nfs
  6. #启动 NFS 服务
  7. systemctl start rpcbind
  8. 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