k8s持久化存储之NFS
- 0
#讨论区
00条评论
实时对话
loading...
首先在集群之外安装服务端
bash
所有节点安装nfs客户端!!⚠️
bash
参考https://github.com/kubernetes-csi/csi-driver-nfs/blob/master/docs/install-csi-driver-master.md
bash
参考https://github.com/kubernetes-csi/csi-driver-nfs/blob/master/deploy/storageclass.yaml 博主直接使用
bash
apt update
apt upgrade
apt install nfs-kernel-server
mkdir -p /srv/nfs/share #创建共享目录
chmod 777 /srv/nfs/share #分配权限
echo "/srv/nfs/share 192.168.100.0/24(rw,sync,no_root_squash,no_subtree_check)" >> /etc/exports
exportfs -rv //使配置生效
#验证挂载
showmount -e localhost
#Export list for localhost:
#/srv/nfs/share 192.168.100.0/22
apt update
apt upgrade
apt-get install -y nfs-common
showmount -e 192.168.100.193
#Export list for 192.168.100.0:
#/srv/nfs/share 192.168.100.0/22
curl -skSL https://raw.githubusercontent.com/kubernetes-csi/csi-driver-nfs/master/deploy/install-driver.sh | bash -s master --
kubtctl apply -f https://git.ooxo.cc/k8s/yaml/raw/branch/main/storageclass-nfs.yaml