nfs mount the file

1. Install the plug-ins necessary to prevent centos7 default nfs service does not start

    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. Set up a shared directory password verification to remove insecure

    vim /etc/exports

  Add the line

   /mnt/nfs/ *(insecure,rw,async,no_root_squash)

3. Restart the direct use mount command

  Create a directory

  mkdir / mnt / nfs

  sudo mount -t nfs 172.19.68.9:/mnt/nfs/ /mnt/nfs

Appendix deployment.yaml content

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

 

Guess you like

Origin www.cnblogs.com/mutong1228/p/10942100.html