Rancher里面安装NFS
官网地址:https://docs.rancher.cn/docs/rancher2.5/cluster-admin/volumes-and-storage/examples/nfs/_index/
所有的节点都要安装 150节点作为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 27 28
| yum install -y nfs-utils rpcbind
在某个节点上 192.168.77.150(我的rancher节点,) 节点创建目录
mkdir -p /nfs chmod 777 /nfs
更改归属组和用户 chown nfsnobody /nfs
vi /etc/exports /nfs *(rw,sync,no_subtree_check,no_root_squash) 启动服务 systemctl start rpcbind && systemctl start nfs 设置开启启动 systemctl enable rpcbind && systemctl enable nfs 检查配置是否生效 exportfs
启动其他节点执行nfs的节点的命令 showmount -e 192.168.77.150
[root@k8s-node-02 ~]# showmount -e 192.168.77.150 Export list for 192.168.77.150: /nfs *
看到上述界面,就是配置成功了
|
Rancher创建持久卷PV

进入如下页面

基本配置之后,点击保存按钮,当出现Available的时候,就是配置完成了

创建PVC
- 点击dev集群
- 点击对应的命名空间(default)
- 选择PVC选项卡
- 点击右侧添加PVC

创建完成 PVC之后就可以使用了
测试创建mysql
创建mysql镜像


指定持久卷的相对目录是mysql
启动mysql容器
验证结果
效果图如下:可以看到,装nfs存储服务的节点,对应的nfs目录下面有一个mysql的挂载目录
