csi-driver-nfs/deploy/example
andyzhangx ce9eab1857 chore: remove hard mount option 2022-05-11 07:36:43 +00:00
..
fsgroup Update README.md 2021-06-02 14:40:32 +08:00
nfs-provisioner chore: remove hard mount option 2022-05-11 07:36:43 +00:00
README.md chore: remove hard mount option 2022-05-11 07:36:43 +00:00
daemonset-nfs-ephemeral.yaml doc: add daemonset-nfs-ephemeral.yaml example 2021-07-05 02:56:08 +00:00
deployment.yaml test: refactor verify example test 2021-01-18 14:31:26 +00:00
nginx-pod-inline-volume.yaml feat: add mountOptions parameter for inline volume 2022-01-11 13:54:21 +00:00
pv-nfs-csi.yaml chore: remove hard mount option 2022-05-11 07:36:43 +00:00
pvc-nfs-csi-dynamic.yaml doc: format yaml files 2020-12-26 14:06:58 +00:00
pvc-nfs-csi-static.yaml doc: refine PV doc 2022-04-03 03:10:43 +00:00
statefulset.yaml doc: format yaml files 2020-12-26 14:06:58 +00:00
storageclass-nfs.yaml chore: remove hard mount option 2022-05-11 07:36:43 +00:00

README.md

CSI driver example

You can use NFS CSI Driver to provision Persistent Volumes statically or dynamically. Please read Kubernetes Persistent Volumes documentation for more information about Static and Dynamic provisioning.

Please refer to driver parameters for more detailed usage.

Prerequisite

Storage Class Usage (Dynamic Provisioning)

  • Create a storage class

change server, share with your existing NFS server address and share name

apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: nfs-csi
provisioner: nfs.csi.k8s.io
parameters:
  server: nfs-server.default.svc.cluster.local
  share: /
  # csi.storage.k8s.io/provisioner-secret is only needed for providing mountOptions in DeleteVolume
  # csi.storage.k8s.io/provisioner-secret-name: "mount-options"
  # csi.storage.k8s.io/provisioner-secret-namespace: "default"
reclaimPolicy: Delete
volumeBindingMode: Immediate
mountOptions:
  - nconnect=8  # only supported on linux kernel version >= 5.3
  - nfsvers=4.1
  • create PVC
kubectl create -f https://raw.githubusercontent.com/kubernetes-csi/csi-driver-nfs/master/deploy/example/pvc-nfs-csi-dynamic.yaml

PV/PVC Usage (Static Provisioning)

  • Follow the following command to create PersistentVolume and PersistentVolumeClaim statically.
# create PV
kubectl create -f https://raw.githubusercontent.com/kubernetes-csi/csi-driver-nfs/master/deploy/example/pv-nfs-csi.yaml

# create PVC
kubectl create -f https://raw.githubusercontent.com/kubernetes-csi/csi-driver-nfs/master/deploy/example/pvc-nfs-csi-static.yaml

Create a deployment

kubectl create -f https://raw.githubusercontent.com/kubernetes-csi/csi-driver-nfs/master/deploy/example/deployment.yaml