码迷,mamicode.com
首页 > 其他好文 > 详细

nfs挂载文件

时间:2019-05-29 10:29:28      阅读:132      评论:0      收藏:0      [点我收藏+]

标签:ntp   str   label   volumes   nfs挂载   api   path   async   insecure   

1. 安装必备插件  以防centos7默认没有启动nfs服务

    yum -y install nfs-utils rpcbind

    service rpcbind start

    service nfs start

[root@master 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挂载文件

标签:ntp   str   label   volumes   nfs挂载   api   path   async   insecure   

原文地址:https://www.cnblogs.com/mutong1228/p/10942100.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!