nfs挂载文件
Posted mutong1228
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了nfs挂载文件相关的知识,希望对你有一定的参考价值。
1. 安装必备插件 以防centos7默认没有启动nfs服务
yum -y install nfs-utils rpcbind
service rpcbind start
service nfs start
[[email protected] nfs]# ps -ef|grep nfs root 5598 2 0 10:08 ? 00:00:00 [nfsd4_callbacks] root 5604 2 0 10:08 ? 00:00:00 [nfsd] root 5605 2 0 10:08 ? 00:00:00 [nfsd] root 5606 2 0 10:08 ? 00:00:00 [nfsd] root 5607 2 0 10:08 ? 00:00:00 [nfsd] root 5608 2 0 10:08 ? 00:00:00 [nfsd] root 5609 2 0 10:08 ? 00:00:00 [nfsd] root 5610 2 0 10:08 ? 00:00:00 [nfsd] root 5611 2 0 10:08 ? 00:00:00 [nfsd] root 5766 2 0 10:09 ? 00:00:00 [nfsv4.1-svc] root 7703 14805 0 10:15 pts/1 00:00:00 grep --color=auto nfs root 26932 2 0 09:36 ? 00:00:00 [nfsiod] root 26942 2 0 09:36 ? 00:00:00 [nfsv4.0-svc]
2. 设置共享目录 去掉密码校验insecure
vim /etc/exports
增加一行
/mnt/nfs/ *(insecure,rw,async,no_root_squash)
3. 重启直接用命令挂载
创建目录
mkdir /mnt/nfs
sudo mount -t nfs 172.19.68.9:/mnt/nfs/ /mnt/nfs
附录deployment.yaml内容
kubectl replace -f deployment.yaml
apiVersion: v1 kind: ServiceAccount metadata: name: nfs-client-provisioner --- kind: Deployment apiVersion: extensions/v1beta1 metadata: name: nfs-client-provisioner spec: replicas: 1 strategy: type: Recreate template: metadata: labels: app: nfs-client-provisioner spec: serviceAccount: nfs-client-provisioner containers: - name: nfs-client-provisioner image: quay.io/external_storage/nfs-client-provisioner:latest volumeMounts: - name: nfs-client-root mountPath: /persistentvolumes env: - name: PROVISIONER_NAME value: fuseim.pri/ifs - name: NFS_SERVER value: 172.19.68.9 - name: NFS_PATH value: /mnt/nfs volumes: - name: nfs-client-root nfs: server: 172.19.68.9 path: /mnt/nfs
以上是关于nfs挂载文件的主要内容,如果未能解决你的问题,请参考以下文章
关于NFS客户端挂载成功但不显示NFS服务端挂载目录下的文件的处理办法及问题还原。
请教关于nfs挂载时报Permission Denied的原因