架構圖如下
本篇以External-Storage NFS-Client設定為主
確定nfs掛載是否正常
mount -t nfs 172.31.17.61:/data/volumes/nfs /data/volumes/nfs
安裝
helm upgrade --install nfs-storage nfs-subdir-external-provisioner/nfs-subdir-external-provisioner --version 4.0.12 \ --set nfs.server=172.31.17.61 \ --set nfs.path=/data/volumes/nfs \ --set nfs.mountOptions="{hard,nfsvers=4}" \ --set storageClass.name="nfs-storage" \ --set storageClass.accessModes="ReadWriteOnce" \ --set storageClass.archiveOnDelete=false
檢查
kubectl get StorageClass
驗證
cat < pvc-test.yaml apiVersion: v1 kind: PersistentVolumeClaim metadata: name: pvc-test spec: storageClassName: "nfs-storage" accessModes: - ReadWriteMany resources: requests: storage: 10Mi EOF