---
# StorageClass
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
namespace: arts-system
name: artsslow
provisioner: kubernetes.io/no-provisioner
volumeBindingMode: WaitForFirstConsumer
---
# pv
apiVersion: v1
kind: PersistentVolume
metadata:
namespace: arts-system
name: arts-pv
spec:
capacity:
storage: 100Gi
volumeMode: Filesystem
accessModes:
- ReadWriteMany
persistentVolumeReclaimPolicy: Retain
storageClassName: artsslow
nfs:
#path: /data/nfs
#server: 192.168.73.10
path: /data
server: 192.168.0.10
---
# pvc
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
namespace: arts-system
name: arts-pvc
spec:
accessModes:
- ReadWriteMany
storageClassName: artsslow
resources:
requests:
storage: 100Gi
---
# test pod
apiVersion: v1
kind: Pod
metadata:
namespace: arts-system
name: arts-test-pod
spec:
containers:
- name: app
image: nginx
imagePullPolicy: IfNotPresent
volumeMounts:
- name: arts-nfs-storage
mountPath: /usr/share/nginx/html
subPath: artsdata/test/nginx/nginxfile
volumes:
- name: arts-nfs-storage
persistentVolumeClaim:
claimName: artspvc
利用nfs创建PVC为pod提供存储
最新推荐文章于 2024-08-06 14:06:28 发布