Host: nfs-server.local.example.com
(10.0.10.1)
sudo apt install nfs-kernel-server
sudo systemctl status nfs-kernel-server
sudo systemctl start nfs-kernel-server
sudo mkdir -pv /srv/nfs/nomad
cat /etc/exports
# Output:
# /srv/nfs/nomad 10.0.10.0/24(rw,sync,no_subtree_check,no_root_squash)
sudo exportfs -a -v
sudo exportfs -s
Just for testing the NFS server, not required for Nomad.
Host: nomad-client-01
(10.0.10.10)
sudo apt install nfs-common
sudo mkdir -pv /var/opt/nfs-tests
sudo mount -v nfs-server.local.example.com:/srv/nfs/nomad /var/opt/nfs-tests
sudo touch /var/opt/nfs-tests/test1.txt
sudo chown -v ubuntu: /var/opt/nfs-tests/test1.txt
sudo chown -v consul: /var/opt/nfs-tests/test1.txt
Note
Docker plugin's
allow_privileged
option must be enabled in Nomad clients before proceeding.
Plugin controller and node:
nomad namespace apply 'plugins-csi-nfs'
nomad job plan controller.nomad
nomad job run controller.nomad
nomad job plan nodes.nomad
nomad job run nodes.nomad
nomad plugin status
nomad plugin status nfs
Volume:
nomad namespace apply 'nginx'
nomad volume register nginx-data.nomad
nomad volume status
NOMAD_NAMESPACE=nginx nomad volume deregister nginx-data
Job:
nomad job plan nginx.nomad
nomad job run nginx.nomad