Skip to content

Instantly share code, notes, and snippets.

@johnsimcall
Last active November 16, 2023 11:58
Show Gist options
  • Save johnsimcall/f17c2cb21e1365de7040296ac30ae421 to your computer and use it in GitHub Desktop.
Save johnsimcall/f17c2cb21e1365de7040296ac30ae421 to your computer and use it in GitHub Desktop.
NFS server/export setup on RHEL8
dnf install nfs-utils
mkdir -p /exports/openshift
chmod 755 /exports/openshift
chown -R nfsnobody:nfsnobody /exports/openshift
semanage fcontext --add --type nfs_t "/exports/openshift(/.*)?"
restorecon -R -v /exports/openshift
echo "/exports/openshift *(insecure,no_root_squash,async,rw)" >> /etc/exports
firewall-cmd --add-service nfs \
--add-service mountd \
--add-service rpc-bind \
--permanent
firewall-cmd --reload
systemctl enable --now nfs-server
systemctl status nfs-server
exportfs -av
showmount -e localhost
@johnsimcall
Copy link
Author

I have a guide for configuring OpenShift to use nfs-subdir-external-provisioner - https://gist.github.com/johnsimcall/0428b7768e50ece76d63db5ec2ab39b5

@johnsimcall
Copy link
Author

I noticed that Ubuntu 22.04 enables mountd -g option by default (also known as the manage-gids option in /etc/nfs.conf). This setting is described in the man page as, "If you use the -g flag, then the list of group ids received from the client (OpenShift) will be replaced by a list of group ids determined by an appropriate lookup on the server (Ubuntu.)"

Ubuntu NFS server wasn't working for csi-driver-nfs until I disabled the -g option by creating an override file in /etc/nfs.conf.d/...

echo -e "[mountd]\nmanage-gids=n" | sudo tee /etc/nfs.conf.d/disable-mountd-manage-gids.conf

sudo systemctl restart nfs-server nfs-idmapd

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment