Project: Rook (Runtime / Cloud Native Storage)
File: nfs.md

title: NFS Storage Overview NFS storage can be mounted with read/write permission from multiple pods. NFS storage may be especially useful for leveraging an existing Rook cluster to provide NFS storage for legacy applications that assume an NFS client connection. Such applications may not have been migrated to Kubernetes or might not yet support PVCs. Rook NFS storage can provide access to the same network filesystem storage from within the Kubernetes cluster via PVC while simultaneously providing access via direct client connection from within or outside of the Kubernetes cluster. !!! warning Simultaneous access to NFS storage from Pods and from external clients complicates NFS user ID mapping significantly. Client IDs mapped from external clients will not be the same as the IDs associated with the NFS CSI driver, which mount exports for Kubernetes pods. !!! warning Due to a number of Ceph issues and changes, Rook officially only supports Ceph v16.2.7 or higher for CephNFS. If you are using an earlier version, upgrade your Ceph version following the advice given in Rook's . !!! note CephNFSes support NFSv4.1+ access only. Serving earlier protocols inhibits responsiveness after a server restart. This guide assumes you have created a Rook cluster as explained in the main as well as a which will act as the backing storage for NFS. Many samples reference the CephNFS and CephFilesystem example manifests and . Create the NFS cluster by specifying the desired settings documented for the . When a CephNFS is first created, all NFS daemons within the CephNFS cluster will share a configuration with no exports defined. When creating an export, it is necessary to specify the CephFilesystem which will act as the backing storage for the NFS export. RADOS Gateways (RGWs), provided by , can also be used as backing storage for NFS exports if desired. Exports can be created via the as well. To enable and use the Ceph dashboard in Rook, see . The Ceph CLI can be used from the Rook toolbox pod to create and manage NFS exports. To do so, first ensure the necessary Ceph mgr modules are enabled, if necessary, and that the Ceph orchestrator backend is set to Rook. Required for Ceph v16.2.7 and below Optional for Ceph v16.2.8 and above Must be disabled for Ceph

due to a ```console ceph mgr module enable rook ceph mgr module enable nfs ceph orch set backend rook ``` can create NFS exports that are backed by (a CephFilesystem) or (a CephObjectStore). `cluster_id` or `cluster-name` in the Ceph NFS docs normally refers to the name of the NFS cluster, which is the CephNFS name in the Rook context. For creating an NFS export for the CephNFS and CephFilesystem example manifests, the below command can be used. This creates an export for the `/test` pseudo path. ```console ceph nfs export create cephfs my-nfs /test myfs ``` The below command will list the current NFS exports for the example CephNFS cluster, which will give the output shown for the current example. ```console $ ceph nfs export ls my-nfs [ "/test" ] ``` The simple `/test` export's info can be listed as well. Notice from the example that only NFS protocol v4 via TCP is supported. ```console $ ceph nfs export info my-nfs /test { "export_id": 1, "path": "/", "cluster_id": "my-nfs", "pseudo": "/test", "access_type": "RW", "squash": "none", "security_label": true, "protocols": [ 4 ], "transports": [ "TCP" ], "fsal": { "name": "CEPH", "user_id": "nfs.my-nfs.1", "fs_name": "myfs" }, "clients": [] } ``` If you are done managing NFS exports and don't need the Ceph orchestrator module enabled for anything else, it may be preferable to disable the Rook and NFS mgr modules to free up a small amount of RAM in the Ceph mgr Pod. ```console ceph orch set backend "" ceph mgr module disable rook ``` Each CephNFS server has a unique Kubernetes Service. This is because NFS clients can't readily handle NFS failover. CephNFS services are named with the pattern `rook-ceph-nfs-<cephnfs-name>-<id>` `<id>` is a unique letter ID (e.g., a, b, c, etc.) for a given NFS server. For example, `rook-ceph-nfs-my-nfs-a`. For each NFS client, choose an NFS service to use for the connection. With NFS v4, you can mount an export by its path using a mount command like below. You can mount all exports at once by omitting the export path and leaving the directory as just `/`. ```console mount -t nfs4 -o proto=tcp <nfs-service-address>:/<export-path> <mount-location> ``` Use a LoadBalancer Service to expose an NFS server (and its exports) outside of the Kubernetes cluster. The Service's endpoint can be used as the NFS service address when . We provide an example Service here: . Security options for NFS are documented . The NFS CSI provisioner and driver are documented Advanced NFS configuration is documented Known issues are documented on the .