k8s 挂载外部 nfs 存储
暴露挂载点的机器:
yum -y install nfs-utils
mkdir -p /nfs/data/
chmod -R 777 /nfs/data
vim /etc/exports
写入以下内容:
/nfs/data *(rw,no_root_squash,sync)
生效配置并查看
exportfs -r
exportfs
启动服务:
systemctl restart rpcbind && systemctl enable rpcbind
systemctl restart nfs-server && systemctl enable nfs-server
其他需要进行挂载的机器:
1 | yum -y install nfs-utils |
测试挂载:showmount -e 192.168.1.2
直接挂载到本地查看:mount 192.168.1.2:/nfs/data /opt
卸载挂载:umount /opt
Pod 挂载使用:
1 | apiVersion: v1 |