NFS Operator creates NFSv4 ganesha servers in Kubernetes, allowing to set ownership/permissions of their NFS export directory; to autoexpand their PVC; and to enable RWX storage from them:
- It can set ownership and permissions for export parent directory of the (NFS) Ganesha server.
- It is able to expand/adjust the PVC size of the (NFS) Ganesha server automatically, as it grows.
- It could autogenerate an StorageClass that uses the (NFS) Ganesha server for RWX storage.
It is based on Ansible Operator SDK.
This operator is part of the Kubernetes operators and tools developed by Krestomatio, a managed service for Moodle™ instances
Dependencies
A previous version had NFS Rook as a dependency. However, it is no longer the case
- NFS CSI driver
version >= v3.0.0
for dynamic provisioning
Install
The Kubernetes Operator in this project is in Alpha version. Use at your own risk
Follow the next steps to install the NFS Operator:
# install this operator
make deploy
# create a nfs ganesha server cr/object from sample
kubectl apply -f config/samples/nfs_v1alpha1_ganesha.yaml
# follow/check nfs operator logs
kubectl -n nfs-operator-system logs -l control-plane=controller-manager -c manager -f
# follow sample nfs ganesha server cr/object status
kubectl get ganesha ganesha-sample -o yaml -w
Uninstall
Follow the next steps to uninstall it.
# delete the nfs ganesha server cr/object
# CAUTION with data loss
kubectl delete -f config/samples/nfs_v1alpha1_ganesha.yaml
# uninstall this operator
make undeploy
Configuration Options
For a Custom Resource (CR) sample of a (NFS) Ganesha server, see: sample
Ownership/Permissions
To set export folder ownership, set ganeshaExportUserid and ganeshaExportGroupid. For export folder permissions, set ganeshaExportMode. For instance:
spec:
# Ownership/permissions
## Set export folder userid to 48
ganeshaExportUserid: 48
## Set export folder groupid to 0
ganeshaExportGroupid: 0
## Set export folder permissions to 775
ganeshaExportMode: 755
Autoexpansion
When autoexpansion is enabled (ganeshaPvcDataAutoexpansion), if storage available is less than 20% or below ganeshaPvcDataAutoexpansionIncrementGib, PVC storage size is auto incremented according to ganeshaPvcDataAutoexpansionIncrementGib. However, it will not be increment beyond ganeshaPvcDataAutoexpansionCapGib (see related function). The following is a config example for it:
spec:
# Autoexpansion
## Enable autoexpansion
ganeshaPvcDataAutoexpansion: true
## Every time autoexpansion is required, increment 5 GiB
ganeshaPvcDataAutoexpansionIncrementGib: 5
### But no more than 25 GiB
ganeshaPvcDataAutoexpansionCapGib: 25
Please, you should take into consideration the following:
- Not all types of storage are compatible. For instance, hostpath is not.
- Kubernetes cluster and PVC must support expansion of volumes
- In older K8s versions, (NFS) Ganesha server pod may be restart when autoexpansion is enabled if Kubernetes feature gate ExpandInUsePersistentVolumes is false. See: Kubernetes Feature Gates
RWX Storage
StorageClass
(SC) autocreation could be specified in the (NFS) Ganesha server CR. The default is to generate one SC.
SC default name is defined using (NFS) Ganesha server CR name + suffix -nfs-sc. For example: if a CR is created with the name: ganesha-sample, a storage class named ganesha-sample-sc is also created and showed in the CR status.
Advanced Options
For advanced configuration options available for CR spec, take a look at the options
Want to contribute?
- Use Github issues to report bugs, send enhancement, new feature requests and questions
- Join our telegram group
About Krestomatio
Krestomatio is a managed service for Moodle™ e-learning platforms. It allows you to have open-source instances managed by a service optimized for Moodle™, complete with an additional plugin pack and customization options.