nfs

构建NFS服务器

# yum -y install nfs-utils
# mkdir -p /data/nfs-vol
# chown nfsnobody:nfsnobody /data/nfs-vol/
# cat /etc/exports
/data/nfs-vol 172.31.112.0/20(rw,sync,no_root_squash,no_all_squash)
# systemctl start nfs-server
# systemctl start rpcbind
# systemctl start nfs-lock
# systemctl start nfs-idmap
# journalctl -u nfs-server

其他节点测试挂载

# mount -t nfs node001:/data/nfs-vol /mnt/

清单文件

apiVersion: v1
kind: Pod
metadata:
  name: myapp-vol-nfs
  namespace: default
spec:
  containers:
  - name: myapp
    image: ikubernetes/myapp:v1
    volumeMounts:
    - name: html-vol
      mountPath: /usr/share/nginx/html/
  volumes:
  - name: html-vol
    nfs:
      path: /data/nfs-vol
      server: node001

results matching ""

    No results matching ""