3 =============================
4 CephFS & RGW Exports over NFS
5 =============================
7 CephFS namespaces and RGW buckets can be exported over NFS protocol
8 using the `NFS-Ganesha NFS server`_.
10 The ``nfs`` manager module provides a general interface for managing
11 NFS exports of either CephFS directories or RGW buckets. Exports can
12 be managed either via the CLI ``ceph nfs export ...`` commands
15 The deployment of the nfs-ganesha daemons can also be managed
16 automatically if either the :ref:`cephadm` or :ref:`mgr-rook`
17 orchestrators are enabled. If neither are in use (e.g., Ceph is
18 deployed via an external orchestrator like Ansible or Puppet), the
19 nfs-ganesha daemons must be manually deployed; for more information,
20 see :ref:`nfs-ganesha-config`.
22 .. note:: Starting with Ceph Pacific, the ``nfs`` mgr module must be enabled.
24 NFS Cluster management
25 ======================
27 .. _nfs-module-cluster-create:
29 Create NFS Ganesha Cluster
30 --------------------------
34 $ ceph nfs cluster create <cluster_id> [<placement>] [--ingress] [--virtual_ip <value>] [--ingress-mode {default|keepalive-only|haproxy-standard|haproxy-protocol}] [--port <int>]
36 This creates a common recovery pool for all NFS Ganesha daemons, new user based on
37 ``cluster_id``, and a common NFS Ganesha config RADOS object.
39 .. note:: Since this command also brings up NFS Ganesha daemons using a ceph-mgr
40 orchestrator module (see :doc:`/mgr/orchestrator`) such as cephadm or rook, at
41 least one such module must be enabled for it to work.
43 Currently, NFS Ganesha daemon deployed by cephadm listens on the standard
44 port. So only one daemon will be deployed on a host.
46 ``<cluster_id>`` is an arbitrary string by which this NFS Ganesha cluster will be
47 known (e.g., ``mynfs``).
49 ``<placement>`` is an optional string signifying which hosts should have NFS Ganesha
50 daemon containers running on them and, optionally, the total number of NFS
51 Ganesha daemons on the cluster (should you want to have more than one NFS Ganesha
52 daemon running per node). For example, the following placement string means
53 "deploy NFS Ganesha daemons on nodes host1 and host2 (one daemon per host)::
57 and this placement specification says to deploy single NFS Ganesha daemon each
58 on nodes host1 and host2 (for a total of two NFS Ganesha daemons in the
63 NFS can be deployed on a port other than 2049 (the default) with ``--port <port>``.
65 To deploy NFS with a high-availability front-end (virtual IP and load balancer), add the
66 ``--ingress`` flag and specify a virtual IP address. This will deploy a combination
67 of keepalived and haproxy to provide an high-availability NFS frontend for the NFS
70 .. note:: The ingress implementation is not yet complete. Enabling
71 ingress will deploy multiple ganesha instances and balance
72 load across them, but a host failure will not immediately
73 cause cephadm to deploy a replacement daemon before the NFS
74 grace period expires. This high-availability functionality
75 is expected to be completed by the Quincy release (March
78 For more details, refer :ref:`orchestrator-cli-placement-spec` but keep
79 in mind that specifying the placement via a YAML file is not supported.
81 Deployment of NFS daemons and the ingress service is asynchronous: the
82 command may return before the services have completely started. You may
83 wish to check that these services do successfully start and stay running.
84 When using cephadm orchestration, these commands check service status:
88 $ ceph orch ls --service_name=nfs.<cluster_id>
89 $ ceph orch ls --service_name=ingress.nfs.<cluster_id>
95 The core *nfs* service will deploy one or more nfs-ganesha daemons,
96 each of which will provide a working NFS endpoint. The IP for each
97 NFS endpoint will depend on which host the nfs-ganesha daemons are
98 deployed. By default, daemons are placed semi-randomly, but users can
99 also explicitly control where daemons are placed; see
100 :ref:`orchestrator-cli-placement-spec`.
102 When a cluster is created with ``--ingress``, an *ingress* service is
103 additionally deployed to provide load balancing and high-availability
104 for the NFS servers. A virtual IP is used to provide a known, stable
105 NFS endpoint that all clients can use to mount. Ceph will take care
106 of the details of NFS redirecting traffic on the virtual IP to the
107 appropriate backend NFS servers, and redeploying NFS servers when they
110 An optional ``--ingress-mode`` parameter can be provided to choose
111 how the *ingress* service is configured:
113 - Setting ``--ingress-mode keepalive-only`` deploys a simplified *ingress*
114 service that provides a virtual IP with the nfs server directly binding to
115 that virtual IP and leaves out any sort of load balancing or traffic
116 redirection. This setup will restrict users to deploying only 1 nfs daemon
117 as multiple cannot bind to the same port on the virtual IP.
118 - Setting ``--ingress-mode haproxy-standard`` deploys a full *ingress* service
119 to provide load balancing and high-availability using HAProxy and keepalived.
120 Client IP addresses are not visible to the back-end NFS server and IP level
121 restrictions on NFS exports will not function.
122 - Setting ``--ingress-mode haproxy-protocol`` deploys a full *ingress* service
123 to provide load balancing and high-availability using HAProxy and keepalived.
124 Client IP addresses are visible to the back-end NFS server and IP level
125 restrictions on NFS exports are usable. This mode requires NFS Ganesha version
127 - Setting ``--ingress-mode default`` is equivalent to not providing any other
128 ingress mode by name. When no other ingress mode is specified by name
129 the default ingress mode used is ``haproxy-standard``.
131 Ingress can be added to an existing NFS service (e.g., one initially created
132 without the ``--ingress`` flag), and the basic NFS service can
133 also be modified after the fact to include non-default options, by modifying
134 the services directly. For more information, see :ref:`cephadm-ha-nfs`.
136 Show NFS Cluster IP(s)
137 ----------------------
139 To examine an NFS cluster's IP endpoints, including the IPs for the individual NFS
140 daemons, and the virtual IP (if any) for the ingress service,
144 $ ceph nfs cluster info [<cluster_id>]
146 .. note:: This will not work with the rook backend. Instead, expose the port with
147 the kubectl patch command and fetch the port details with kubectl get services
150 $ kubectl patch service -n rook-ceph -p '{"spec":{"type": "NodePort"}}' rook-ceph-nfs-<cluster-name>-<node-id>
151 $ kubectl get services -n rook-ceph rook-ceph-nfs-<cluster-name>-<node-id>
154 Delete NFS Ganesha Cluster
155 --------------------------
159 $ ceph nfs cluster rm <cluster_id>
161 This deletes the deployed cluster.
164 Removal of NFS daemons and the ingress service is asynchronous: the
165 command may return before the services have been completely deleted. You may
166 wish to check that these services are no longer reported. When using cephadm
167 orchestration, these commands check service status:
171 $ ceph orch ls --service_name=nfs.<cluster_id>
172 $ ceph orch ls --service_name=ingress.nfs.<cluster_id>
175 Updating an NFS Cluster
176 -----------------------
178 In order to modify cluster parameters (like the port or placement), you need to
179 use the orchestrator interface to update the NFS service spec. The safest way to do
180 that is to export the current spec, modify it, and then re-apply it. For example,
181 to modify the ``nfs.foo`` service,
185 $ ceph orch ls --service-name nfs.foo --export > nfs.foo.yaml
187 $ ceph orch apply -i nfs.foo.yaml
189 For more information about the NFS service spec, see :ref:`deploy-cephadm-nfs-ganesha`.
191 List NFS Ganesha Clusters
192 -------------------------
196 $ ceph nfs cluster ls
198 This lists deployed clusters.
202 Set Customized NFS Ganesha Configuration
203 ----------------------------------------
207 $ ceph nfs cluster config set <cluster_id> -i <config_file>
209 With this the nfs cluster will use the specified config and it will have
210 precedence over default config blocks.
212 Example use cases include:
214 #. Changing log level. The logging level can be adjusted with the following config
223 #. Adding custom export block.
225 The following sample block creates a single export. This export will not be
226 managed by `ceph nfs export` interface::
235 Attr_Expiration_Time = 0;
239 Filesystem = "filesystem name";
241 Secret_Access_Key = "secret key";
245 .. note:: User specified in FSAL block should have proper caps for NFS-Ganesha
246 daemons to access ceph cluster. User can be created in following way using
247 `auth get-or-create`::
249 # ceph auth get-or-create client.<user_id> mon 'allow r' osd 'allow rw pool=.nfs namespace=<nfs_cluster_name>, allow rw tag cephfs data=<fs_name>' mds 'allow rw path=<export_path>'
251 View Customized NFS Ganesha Configuration
252 -----------------------------------------
256 $ ceph nfs cluster config get <cluster_id>
258 This will output the user defined configuration (if any).
260 Reset NFS Ganesha Configuration
261 -------------------------------
265 $ ceph nfs cluster config reset <cluster_id>
267 This removes the user defined configuration.
269 .. note:: With a rook deployment, ganesha pods must be explicitly restarted
270 for the new config blocks to be effective.
276 .. warning:: Currently, the nfs interface is not integrated with dashboard. Both
277 dashboard and nfs interface have different export requirements and
278 create exports differently. Management of dashboard created exports is not
286 $ ceph nfs export create cephfs --cluster-id <cluster_id> --pseudo-path <pseudo_path> --fsname <fsname> [--readonly] [--path=/path/in/cephfs] [--client_addr <value>...] [--squash <value>] [--sectype <value>...]
288 This creates export RADOS objects containing the export block, where
290 ``<cluster_id>`` is the NFS Ganesha cluster ID.
292 ``<pseudo_path>`` is the export position within the NFS v4 Pseudo Filesystem where the export will be available on the server. It must be an absolute path and unique.
294 ``<fsname>`` is the name of the FS volume used by the NFS Ganesha cluster
295 that will serve this export.
297 ``<path>`` is the path within cephfs. Valid path should be given and default
298 path is '/'. It need not be unique. Subvolume path can be fetched using:
302 $ ceph fs subvolume getpath <vol_name> <subvol_name> [--group_name <subvol_group_name>]
304 ``<client_addr>`` is the list of client address for which these export
305 permissions will be applicable. By default all clients can access the export
306 according to specified export permissions. See the `NFS-Ganesha Export Sample`_
307 for permissible values.
309 ``<squash>`` defines the kind of user id squashing to be performed. The default
310 value is `no_root_squash`. See the `NFS-Ganesha Export Sample`_ for
313 ``<sectype>`` specifies which authentication methods will be used when
314 connecting to the export. Valid values include "krb5p", "krb5i", "krb5", "sys",
315 and "none". More than one value can be supplied. The flag may be specified
316 multiple times (example: ``--sectype=krb5p --sectype=krb5i``) or multiple
317 values may be separated by a comma (example: ``--sectype krb5p,krb5i``). The
318 server will negotatiate a supported security type with the client preferring
319 the supplied methods left-to-right.
321 .. note:: Specifying values for sectype that require Kerberos will only function on servers
322 that are configured to support Kerberos. Setting up NFS-Ganesha to support Kerberos
323 is outside the scope of this document.
325 .. note:: Export creation is supported only for NFS Ganesha clusters deployed using nfs interface.
330 There are two kinds of RGW exports:
332 - a *user* export will export all buckets owned by an
333 RGW user, where the top-level directory of the export is a list of buckets.
334 - a *bucket* export will export a single bucket, where the top-level directory contains
335 the objects in the bucket.
340 To export a *bucket*:
344 $ ceph nfs export create rgw --cluster-id <cluster_id> --pseudo-path <pseudo_path> --bucket <bucket_name> [--user-id <user-id>] [--readonly] [--client_addr <value>...] [--squash <value>] [--sectype <value>...]
346 For example, to export *mybucket* via NFS cluster *mynfs* at the pseudo-path */bucketdata* to any host in the ``192.168.10.0/24`` network
350 $ ceph nfs export create rgw --cluster-id mynfs --pseudo-path /bucketdata --bucket mybucket --client_addr 192.168.10.0/24
352 .. note:: Export creation is supported only for NFS Ganesha clusters deployed using nfs interface.
354 ``<cluster_id>`` is the NFS Ganesha cluster ID.
356 ``<pseudo_path>`` is the export position within the NFS v4 Pseudo Filesystem where the export will be available on the server. It must be an absolute path and unique.
358 ``<bucket_name>`` is the name of the bucket that will be exported.
360 ``<user_id>`` is optional, and specifies which RGW user will be used for read and write
361 operations to the bucket. If it is not specified, the user who owns the bucket will be
364 .. note:: Currently, if multi-site RGW is enabled, Ceph can only export RGW buckets in the default realm.
366 ``<client_addr>`` is the list of client address for which these export
367 permissions will be applicable. By default all clients can access the export
368 according to specified export permissions. See the `NFS-Ganesha Export Sample`_
369 for permissible values.
371 ``<squash>`` defines the kind of user id squashing to be performed. The default
372 value is `no_root_squash`. See the `NFS-Ganesha Export Sample`_ for
375 ``<sectype>`` specifies which authentication methods will be used when
376 connecting to the export. Valid values include "krb5p", "krb5i", "krb5", "sys",
377 and "none". More than one value can be supplied. The flag may be specified
378 multiple times (example: ``--sectype=krb5p --sectype=krb5i``) or multiple
379 values may be separated by a comma (example: ``--sectype krb5p,krb5i``). The
380 server will negotatiate a supported security type with the client preferring
381 the supplied methods left-to-right.
383 .. note:: Specifying values for sectype that require Kerberos will only function on servers
384 that are configured to support Kerberos. Setting up NFS-Ganesha to support Kerberos
385 is outside the scope of this document.
390 To export an RGW *user*:
394 $ ceph nfs export create rgw --cluster-id <cluster_id> --pseudo-path <pseudo_path> --user-id <user-id> [--readonly] [--client_addr <value>...] [--squash <value>]
396 For example, to export *myuser* via NFS cluster *mynfs* at the pseudo-path */myuser* to any host in the ``192.168.10.0/24`` network
400 $ ceph nfs export create rgw --cluster-id mynfs --pseudo-path /bucketdata --user-id myuser --client_addr 192.168.10.0/24
408 $ ceph nfs export rm <cluster_id> <pseudo_path>
410 This deletes an export in an NFS Ganesha cluster, where:
412 ``<cluster_id>`` is the NFS Ganesha cluster ID.
414 ``<pseudo_path>`` is the pseudo root path (must be an absolute path).
421 $ ceph nfs export ls <cluster_id> [--detailed]
423 It lists exports for a cluster, where:
425 ``<cluster_id>`` is the NFS Ganesha cluster ID.
427 With the ``--detailed`` option enabled it shows entire export block.
434 $ ceph nfs export info <cluster_id> <pseudo_path>
436 This displays export block for a cluster based on pseudo root name,
439 ``<cluster_id>`` is the NFS Ganesha cluster ID.
441 ``<pseudo_path>`` is the pseudo root path (must be an absolute path).
444 Create or update export via JSON specification
445 ----------------------------------------------
447 An existing export can be dumped in JSON format with:
451 ceph nfs export info *<cluster_id>* *<pseudo_path>*
453 An export can be created or modified by importing a JSON description in the
458 ceph nfs export apply *<cluster_id>* -i <json_file>
462 $ ceph nfs export info mynfs /cephfs > update_cephfs_export.json
463 $ cat update_cephfs_export.json
467 "cluster_id": "mynfs",
470 "squash": "no_root_squash",
471 "security_label": true,
480 "user_id": "nfs.mynfs.1",
482 "sec_label_xattr": ""
487 The imported JSON can be a single dict describing a single export, or a JSON list
488 containing multiple export dicts.
490 The exported JSON can be modified and then reapplied. Below, *pseudo*
491 and *access_type* are modified. When modifying an export, the
492 provided JSON should fully describe the new state of the export (just
493 as when creating a new export), with the exception of the
494 authentication credentials, which will be carried over from the
495 previous state of the export where possible.
499 $ ceph nfs export apply mynfs -i update_cephfs_export.json
500 $ cat update_cephfs_export.json
504 "cluster_id": "mynfs",
505 "pseudo": "/cephfs_testing",
507 "squash": "no_root_squash",
508 "security_label": true,
517 "user_id": "nfs.mynfs.1",
519 "sec_label_xattr": ""
524 An export can also be created or updated by injecting a Ganesha NFS EXPORT config
525 fragment. For example,::
527 $ ceph nfs export apply mynfs -i update_cephfs_export.conf
528 $ cat update_cephfs_export.conf
539 attr_expiration_time = 0;
540 security_label = true;
549 After the exports are successfully created and NFS Ganesha daemons are
550 deployed, exports can be mounted with:
554 $ mount -t nfs <ganesha-host-name>:<pseudo_path> <mount-point>
556 For example, if the NFS cluster was created with ``--ingress --virtual-ip 192.168.10.10``
557 and the export's pseudo-path was ``/foo``, the export can be mounted at ``/mnt`` with:
561 $ mount -t nfs 192.168.10.10:/foo /mnt
563 If the NFS service is running on a non-standard port number:
567 $ mount -t nfs -o port=<ganesha-port> <ganesha-host-name>:<ganesha-pseudo_path> <mount-point>
569 .. note:: Only NFS v4.0+ is supported.
574 Checking NFS-Ganesha logs with
576 1) ``cephadm``: The NFS daemons can be listed with:
580 $ ceph orch ps --daemon-type nfs
582 You can via the logs for a specific daemon (e.g., ``nfs.mynfs.0.0.myhost.xkfzal``) on
583 the relevant host with:
587 # cephadm logs --fsid <fsid> --name nfs.mynfs.0.0.myhost.xkfzal
593 $ kubectl logs -n rook-ceph rook-ceph-nfs-<cluster_id>-<node_id> nfs-ganesha
595 The NFS log level can be adjusted using `nfs cluster config set` command (see :ref:`nfs-cluster-set`).
598 .. _nfs-ganesha-config:
601 Manual Ganesha deployment
602 =========================
604 It may be possible to deploy and manage the NFS ganesha daemons without
605 orchestration frameworks such as cephadm or rook.
607 .. note:: Manual configuration is not tested or fully documented; your
608 mileage may vary. If you make this work, please help us by
609 updating this documentation.
614 If no orchestrator module is enabled for the Ceph Manager the NFS cluster
615 management commands, such as those starting with ``ceph nfs cluster``, will not
616 function. However, commands that manage NFS exports, like those prefixed with
617 ``ceph nfs export`` are expected to work as long as the necessary RADOS objects
618 have already been created. The exact RADOS objects required are not documented
619 at this time as support for this feature is incomplete. A curious reader can
620 find some details about the object by reading the source code for the
621 ``mgr/nfs`` module (found in the ceph source tree under
622 ``src/pybind/mgr/nfs``).
628 The following packages are required to enable CephFS and RGW exports with nfs-ganesha:
630 - ``nfs-ganesha``, ``nfs-ganesha-ceph``, ``nfs-ganesha-rados-grace`` and
631 ``nfs-ganesha-rados-urls`` packages (version 3.3 and above)
633 Ganesha Configuration Hierarchy
634 -------------------------------
636 Cephadm and rook start each nfs-ganesha daemon with a minimal
637 `bootstrap` configuration file that pulls from a shared `common`
638 configuration stored in the ``.nfs`` RADOS pool and watches the common
639 config for changes. Each export is written to a separate RADOS object
640 that is referenced by URL from the common config.
644 rados://$pool/$namespace/export-$i rados://$pool/$namespace/userconf-nfs.$cluster_id
645 (export config) (user config)
647 +----------+ +----------+ +----------+ +---------------------------+
649 | export-1 | | export-2 | | export-3 | | userconf-nfs.$cluster_id |
651 +----+-----+ +----+-----+ +-----+----+ +-------------+-------------+
654 +--------------------------------+-------------------------+
658 | | rados://$pool/$namespace/conf-nfs.$svc
659 | conf+nfs.$svc | (common config)
665 +----------------------------------------------+
668 +----------------------------------------------------------------------------------+
670 watch_url | watch_url | watch_url |
672 +--------+-------+ +--------+-------+ +-------+--------+
673 | | | | | | /etc/ganesha/ganesha.conf
674 | nfs.$svc.a | | nfs.$svc.b | | nfs.$svc.c | (bootstrap config)
676 +----------------+ +----------------+ +----------------+
679 .. _NFS-Ganesha NFS Server: https://github.com/nfs-ganesha/nfs-ganesha/wiki
680 .. _NFS-Ganesha Export Sample: https://github.com/nfs-ganesha/nfs-ganesha/blob/next/src/config_samples/export.txt