BlueXIII's Blog

热爱技术,持续学习

0%

K8S离线部署笔记-8-NFS服务

服务端

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# 安装
yum -y install nfs-utils
rpcinfo -p localhost

# 创建共享目录
mkdir /nfs

# 修改配置
cat <<EOF > /etc/exports
/nfs *(rw,sync,no_root_squash,no_subtree_check)
EOF

# 使配置生效
exportfs -r

# 启用服务
systemctl enable rpcbind
systemctl start rpcbind
systemctl enable nfs-server
systemctl start nfs-server

# 测试挂载
showmount -e localhost
mkdir /mnt/nfs
mount -t nfs 127.0.0.1:/nfs /mnt/nfs

客户端

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# 安装
yum -y install nfs-utils

# 启用服务
systemctl enable rpcbind
systemctl start rpcbind

# 临时挂载
showmount -e 10.10.51.77
mkdir /mnt/nfs
mount -t nfs 10.10.51.77:/nfs /mnt/nfs

# 永久挂载
sudo vi /etc/fstab
10.10.51.77:/nfs /data nfs defaults 0 0

systemctl daemon-reload
mount

参考文档