NFS Storage
Before you can use the NFS storage volume plug-in with Rancher deployments, you need to provision an NFS server.
|
Recommended:
To simplify the process of managing firewall rules, use NFSv4. |
-
Using a remote Terminal connection, log into the Ubuntu server that you intend to use for NFS storage.
-
Enter the following command:
sudo apt-get install nfs-kernel-server
-
Enter the command below, which sets the directory used for storage, along with user access rights. Modify the command if you’d like to keep storage at a different directory.
mkdir -p /nfs && chown nobody:nogroup /nfs
-
The
-p /nfs
parameter creates a directory namednfs
at root. -
The
chown nobody:nogroup /nfs
parameter allows all access to the storage directory.
-
-
Create an NFS exports table. This table sets the directory paths on your NFS server that are exposed to the nodes that will use the server for storage.
-
Open
/etc/exports
using your text editor of choice. -
Add the path of the
/nfs
folder that you created in step 3, along with the IP addresses of your cluster nodes. Add an entry for each IP address in your cluster. Follow each address and its accompanying parameters with a single space that is a delimiter./nfs <IP_ADDRESS1>(rw,sync,no_subtree_check) <IP_ADDRESS2>(rw,sync,no_subtree_check) <IP_ADDRESS3>(rw,sync,no_subtree_check)
You can replace the IP addresses with a subnet. For example:
10.212.50.12/24
-
Update the NFS table by entering the following command:
exportfs -ra
-
-
Open the ports used by NFS.
-
To find out what ports NFS is using, enter the following command:
rpcinfo -p | grep nfs
-
Open the ports that the previous command outputs. For example, the following command opens port 2049:
sudo ufw allow 2049
-
Result: Your NFS server is configured to be used for storage with your Rancher nodes.