-
Notifications
You must be signed in to change notification settings - Fork 80
NSFS using a Local PV on k8s
Guy Margalit edited this page Apr 22, 2021
·
1 revision
In this example we are showing how to create a Local PV (similar to hostpath) for NSFS.
See https://kubernetes.io/docs/concepts/storage/volumes/#local.
We assuming the filesystem to expose is already mounted in the path /nsfs
in the cluster nodes.
We will create a StorageClass for manual provisioning, then create a local PV that represents the mounted file system on the node at /nsfs, and finally create a PVC to bind to it - notice that the PVC should be created in the noobaa namespace (but storage-class and PV are cluster-wide).
Use the yamls attached below -
kubectl create -f nsfs-local-class.yaml
kubectl create -f nsfs-local-pv.yaml
kubectl create -f nsfs-local-pvc.yaml
nsfs-local-class.yaml:
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: nsfs-local
provisioner: kubernetes.io/no-provisioner
volumeBindingMode: WaitForFirstConsumer
nsfs-local-pv.yaml:
apiVersion: v1
kind: PersistentVolume
metadata:
name: nsfs-vol
spec:
storageClassName: nsfs-local
volumeMode: Filesystem
persistentVolumeReclaimPolicy: Retain
local:
path: /nsfs/
capacity:
storage: 1Ti
accessModes:
- ReadWriteMany
nodeAffinity:
required:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/os
operator: Exists
nsfs-local-pvc.yaml:
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: nsfs-vol
spec:
storageClassName: nsfs-local
resources:
requests:
storage: 1Ti
accessModes:
- ReadWriteMany