Let's perform the following steps to get an NFS provider functional using the Rook NFS provider option:
- Clone the Rook repository:
$ git clone https://github.com/rook/rook.git
$ cd rook/cluster/examples/kubernetes/nfs/
- Deploy the Rook NFS operator:
$ kubectl create -f operator.yaml
- Confirm that the operator is running:
$ kubectl get pods -n rook-nfs-system
NAME READY STATUS RESTARTS AGE
rook-nfs-operator-54cf68686c-f66f5 1/1 Running 0 51s
rook-nfs-provisioner-79fbdc79bb-hf9rn 1/1 Running 0 51s
- Create a namespace, rook-nfs:
$ cat <<EOF | kubectl apply -f -
apiVersion: v1
kind: Namespace
metadata:
name: rook-nfs
EOF
- Make sure that you have defined your preferred storage provider as the default storage class. In this recipe, we are using openebs-cstor-default, defined in persistent storage using the OpenEBS recipe.
- Create a PVC:
$ cat <<EOF | kubectl apply -f -
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: nfs-default-claim
namespace: rook-nfs
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 1Gi
EOF
- Create the NFS instance:
$ cat <<EOF | kubectl apply -f -
apiVersion: nfs.rook.io/v1alpha1
kind: NFSServer
metadata:
name: rook-nfs
namespace: rook-nfs
spec:
serviceAccountName: rook-nfs
replicas: 1
exports:
- name: share1
server:
accessMode: ReadWrite
squash: "none"
persistentVolumeClaim:
claimName: nfs-default-claim
annotations:
# key: value
EOF
- Verify that the NFS pod is in the Running state:
$ kubectl get pod -l app=rook-nfs -n rook-nfs
NAME READY STATUS RESTARTS AGE
rook-nfs-0 1/1 Running 0 2m
By observing the preceding command, an NFS server instance type will be created.