kubernetes-bootstrapping/04-nfs-subdir-provisioner/README.md

1.1 KiB

04 | Dynamic Volume Provisiong to NFS Subdirectory

https://github.com/kubernetes-sigs/nfs-subdir-external-provisioner

To support persistent volume claims on NFS external storage, a provisioner can be configured and deployed easily with helm.


helm repo add nfs-subdir-external-provisioner https://kubernetes-sigs.github.io/nfs-subdir-external-provisioner/

helm install nfs-subdir-external-provisioner nfs-subdir-external-provisioner/nfs-subdir-external-provisioner \
    --set nfs.server=10.69.71.105 \
    --set nfs.path=/data/nfs

A PVC can then be created similar to below example:

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: myclaim
spec:
  accessModes:
    - ReadWriteOnce
  volumeMode: Filesystem
  resources:
    requests:
      storage: 1Gi
  storageClassName: nfs-client
---
apiVersion: v1
kind: Pod
metadata:
  name: mypod
spec:
  containers:
    - name: myfrontend
      image: nginx
      volumeMounts:
      - mountPath: "/var/www/html"
        name: mypd
  volumes:
    - name: mypd
      persistentVolumeClaim:
        claimName: myclaim