美文网首页
07 NFS搭建

07 NFS搭建

作者: 逸章 | 来源:发表于2021-11-08 16:55 被阅读0次

我们这里把NFS服务器搭建再K8s的一个master节点上

1、在NFS服务器上安装服务端软件

# yum -y install  nfs-utils

编辑/etc/exports

[root@centos7 /]# vi /etc/exports
/backup 192.168.108.0/24(rw,sync,no_root_squash)

若是想让所有主机都可以挂载,可以配置为 /backup *(rw,sync,no_root_squash)

[root@k8s-master03 ~]# mkdir /backup
[root@k8s-master03 ~]# chmod -R 777 /backup/

启动服务并设置为开机自动启动

[root@k8s-master03 ~]# systemctl enable rpcbind.service
[root@k8s-master03 ~]# systemctl enable nfs-server.service
Created symlink from /etc/systemd/system/multi-user.target.wants/nfs-server.service to /usr/lib/systemd/system/nfs-server.service.
[root@k8s-master03 ~]# systemctl start rpcbind.service
[root@k8s-master03 ~]# systemctl start nfs-server.service

加载配置并确认最终配置情况

[root@k8s-master03 ~]# exportfs -r
[root@k8s-master03 ~]# exportfs
/backup         192.168.108.0/24
[root@k8s-master03 ~]#
完整过程: image.png

2、在NFS客户端上安装软件

2.1 比如在K8s所有work node上安装

# yum -y install nfs-utils

2.2 检查挂载目录

[root@k8s-master03 Chapter05]# showmount -e 192.168.108.88
Export list for 192.168.108.88:
/backup3 192.168.108.0/16
/backup2 192.168.108.0/16
/backup  192.168.108.0/16

2.3 新建挂载点并挂载:

# mkdir /nfs

挂载共享目录:

# mount -t nfs 192.168.108.88:/backup /nfs

开启自动挂载:

[root@k8s-node1 ~]# cat /etc/rc.local
#!/bin/bash
# THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES
#
# It is highly advisable to create own systemd services or udev rules
# to run scripts during boot instead of using this file.
#
# In contrast to previous versions due to parallel execution during boot
# this script will NOT be run after all other services.
#
# Please note that you must run 'chmod +x /etc/rc.d/rc.local' to ensure
# that this script will be executed during boot.

touch /var/lock/subsys/local
mount -t nfs 192.168.108.88:/backup /nfs
[root@k8s-node1 ~]#

3、测试

image.png image.png image.png

相关文章

  • 07 NFS搭建

    我们这里把NFS服务器搭建再K8s的一个master节点上 1、在NFS服务器上安装服务端软件 编辑/etc/ex...

  • CENTOS6 NFS 环境构建

    CENTOS6 NFS 环境构建 nfs server => NFS Server 搭建, CENTOS6 安装N...

  • 40-存储-NFS

    一、搭建NFS-Server 安装nfs-utils 创建 exports 文件 启动 NFS 服务并创建共享目录...

  • k8s基于NFS创建Storageclass

    结果展示 搭建NFS服务器 注意:安装nfs相关软件时需要在k8s的各个节点上都要安装参考Centos7搭建NFS...

  • 搭建、挂载nfs及卸载

    搭建 1、 安装 nfs 和 rpc 2、运行 rpc 和 nfs (先启动RPC服务,然后再启动NFS服务) ...

  • 2018-10-24 (linxu如何创建NFS共享文件系统)

    linxu如何创建NFS共享文件系统服务端搭建nfs服务器1. yum -y install nfs-utils ...

  • nfs搭建

    环境 centos7安装 nfs 相关软件包: 修改nfs配置文件,nfs的默认配置文件是 /etc/export...

  • NFS搭建

    一:什么是NFS NFS既网络文件系统,它允许网络中的计算机之间通过TCP/IP网络共享资源.在NFS的应用中,本...

  • 搭建 nfs v4服务器

    搭建 nfsv4 server 环境 安装 nfs kernel server nfs 已经在内核中进行了支持: ...

  • Linux实用工具-nfs

    nfs服务器建立 本文介绍Linux环境下nfs服务的搭建过程。 简介 nfs服务的作用是让其他机器可以通过网络把...

网友评论

      本文标题:07 NFS搭建

      本文链接:https://www.haomeiwen.com/subject/wcouzltx.html