1.先搭建nfs服务器
2.每台节点都挂载nfs目录文件夹
3.使用原生方式挂载的nfs数据,在pod删除后数据不会删除
服务器原生方式挂载,将 /usr/share/nginx/html挂载到nfs文件夹下 apiVersion: apps/v1 kind: Deployment metadata: labels: app: nginx-pv-demo name: nginx-pv-demo spec: replicas: 2 selector: matchLabels: app: nginx-pv-demo template: metadata: labels: app: nginx-pv-demo spec: containers: - image: nginx name: nginx volumeMounts: - name: html mountPath: /usr/share/nginx/html volumes: - name: html nfs: server: 192.168.1.20 path: /nfs/data/nginx-pv
标签:存储,pv,name,kubernetes,demo,nginx,html,抽象,nfs From: https://www.cnblogs.com/haoyun123/p/17289580.html