apiVersion: v1 kind: PersistentVolume metadata: name: pv-v1 labels: app: v1 spec: nfs: server: 10.16.17.57 #NFS服务器地址 path: /data/volumes/v1 #NFS路径 accessModes: ["ReadWriteOnce"] #只允许一个节点以读写方式挂载 capacity: storage: 1Gi #存储容量 --- apiVersion: v1 kind: PersistentVolume metadata: name: pv-v2 labels: app: v2 spec: nfs: server: 10.16.17.57 path: /data/volumes/v2 accessModes: ["ReadOnlyMany"] #允许多个节点以只读方式挂载 capacity: storage: 1Gi --- apiVersion: v1 kind: PersistentVolume metadata: name: pv-v3 labels: app: v3 spec: nfs: server: 10.16.17.57 path: /data/volumes/v3 accessModes: ["ReadWriteMany"] #允许多个节点以读写方式挂载 capacity: storage: 1Gi --- apiVersion: v1 kind: PersistentVolumeClaim metadata: name: pvc-v1 spec: accessModes: ["ReadWriteOnce"] #访问模式 selector: matchLabels: #选择器,匹配标签 app: v1 的PV app: v1 resources: requests: storage: 1Gi #请求存储容量 --- apiVersion: v1 kind: PersistentVolumeClaim metadata: name: pvc-v2 spec: accessModes: ["ReadOnlyMany"] selector: matchLabels: app: v2 resources: requests: storage: 1Gi --- apiVersion: v1 kind: PersistentVolumeClaim metadata: name: pvc-v3 spec: accessModes: ["ReadWriteMany"] selector: matchLabels: app: v3 resources: requests: storage: 1Gi
标签:PV,创建,app,storage,v1,PVC,1Gi,spec,metadata From: https://www.cnblogs.com/hm1825/p/18086982