# NFS CSI Install 1. `git clone https://github.com/kubernetes-csi/csi-driver-nfs.git` 2. `git checkout v4.0.0` 3. change yaml at csi-driver-nfs/deploy/v4.0.0/csi-nfs-driverinfo.yaml to: ``` --- apiVersion: storage.k8s.io/v1beta1 kind: CSIDriver metadata: name: nfs.csi.k8s.io spec: attachRequired: false volumeLifecycleModes: - Persistent - Ephemeral podInfoOnMount: true ``` 4. `cd csi-driver-nfs/deploy/v4.0.0` 5. `kubectl apply -f .` # Example yaml ## static ### pv ``` apiVersion: v1 kind: PersistentVolume metadata: name: data-nfsplugin spec: accessModes: - ReadWriteMany capacity: storage: 10Gi csi: driver: nfs.csi.k8s.io volumeAttributes: server: 10.18.252.40 share: /mnt/xanxus volumeHandle: unique-volumeid persistentVolumeReclaimPolicy: Retain volumeMode: Filesystem ``` ### pvc ``` apiVersion: v1 kind: PersistentVolumeClaim metadata: name: data-nfsplugin spec: accessModes: - ReadWriteMany resources: requests: storage: 3Gi volumeMode: Filesystem ``` ### pod ``` apiVersion: v1 kind: Pod metadata: name: nginx spec: containers: - image: nginx:alpine imagePullPolicy: IfNotPresent name: nginx ports: - containerPort: 80 protocol: TCP volumeMounts: - mountPath: /tmp/www name: data-nfsplugin restartPolicy: Always volumes: - name: data-nfsplugin persistentVolumeClaim: claimName: data-nfsplugin ``` ## dynamic ### sc ``` apiVersion: storage.k8s.io/v1 kind: StorageClass metadata: name: csi-nfs provisioner: nfs.csi.k8s.io parameters: server: 10.18.252.40 share: /mnt/xanxus reclaimPolicy: Delete allowVolumeExpansion: false volumeBindingMode: Immediate mountOptions: - hard - nfsvers=4.1 ``` ### pvc ``` apiVersion: v1 kind: PersistentVolumeClaim metadata: name: data-nfsplugin spec: accessModes: - ReadWriteMany resources: requests: storage: 3Gi volumeMode: Filesystem storageClassName: csi-nfs ``` ### pod ``` apiVersion: v1 kind: Pod metadata: name: nginx spec: containers: - image: nginx:alpine imagePullPolicy: IfNotPresent name: nginx ports: - containerPort: 80 protocol: TCP volumeMounts: - mountPath: /tmp/www name: data-nfsplugin restartPolicy: Always volumes: - name: data-nfsplugin persistentVolumeClaim: claimName: data-nfsplugin ```
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up