安装NFS,设置共享目录
#centos yum -y install nfs-utils #ubuntu apt install nfs-server #启动RPC服务 start rpcbind #创建共享目录 mkdir -p /data/share 共享目录 vim /etc/exports /data/share *(rw,no_root_squash) exportfs -arv
挂载NFS
apiVersion: apps/v1 kind: Deployment metadata: name: deploy-nfs spec: replicas: 2 selector: matchLabels: app: nfs template: metadata: name: deploy-nfs labels: app: nfs spec: containers: - name: test-nfs image: harbor.com/nginx:1.20.1 imagePullPolicy: IfNotPresent volumeMounts: - name: nfs-volumes mountPath: /usr/share/nginx/html #挂载到容器的/usr/share/nginx/html路径 volumes: - name: nfs-volumes #卷名称 nfs: server: 10.16.17.57 #设置共享的服务器地址 path: /data/share #共享目录
标签:存储,name,创建,share,nginx,NFS,nfs,共享 From: https://www.cnblogs.com/hm1825/p/18086979