NFS 需要提前搭建, 我使用的Nas 搭建NFS
jms-pv.yaml
apiVersion: v1
kind: PersistentVolume
metadata:
name: redis-data-pv
spec:
capacity:
storage: 1Gi
accessModes:
- ReadWriteMany
persistentVolumeReclaimPolicy: Recycle
storageClassName: "redis-data-pv"
nfs:
path: "/volume1/nfs"
server: 192.168.3.2
jms-pvc.yaml
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: redis-data-pvc
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 1Gi
storageClassName: redis-data-pv
kubectl get pv,pvc -n default
我使用这篇文章配置的NFS。Synology群晖小技巧之创建NFS共享文件夹提供Linux使用 - 腾讯云开发者社区-腾讯云