NFS Service Deployment¶
Note
NFS service is not deployed within a Kubernetes cluster and requires a separate machine for deployment.
Introduction¶
NFS (Network File System) allows different machines and operating systems to share files with each other over a network.
Prerequisites¶
- Access to the public internet
Basic Information and Compatibility¶
Name | Description |
---|---|
Path | /nfsdata (Ensure this directory has sufficient capacity and is on a data disk) |
Offline Installation Support | No |
Supported Architectures | amd64/arm64 |
Deployment Machine IP | 192.168.100.105 |
Installation Steps¶
1. Preparations¶
1.1 Disable Firewall Service¶
2. Installation¶
2.1 Install NFS Service¶
Run the following commands to install the necessary packages for the NFS server and create the mount directory (please ensure it's on a data disk, here using /nfsdata as the data directory)
2.2 Configure NFS Shared Path¶
Run the command vim /etc/exports
to create the exports file, with the following content:
2.3 Start NFS Service¶
Run the following commands to start the NFS service
systemctl enable rpcbind
systemctl enable nfs-server
systemctl restart rpcbind
systemctl restart nfs-server
2.4 Verify Configuration¶
Check if the configuration has taken effect
Query the NFS shared directories on the local machine
3. Verify Deployment¶
3.1 Install Client¶
Run the following command to install the necessary packages for the NFS client
3.2 View Shared Directories¶
Note
192.168.100.105 is the test IP used in this article; you need to replace it with your NFS server IP.
Run the following command to check if the NFS server has set up any shared directories
# showmount -e $(NFS server IP)
showmount -e 192.168.100.105
# The output should look like this
Export list for 192.168.100.105:
/nfsdata *
3.3 Remote Mount Test¶
Note
192.168.100.105 is the test IP used in this article; you need to replace it with your NFS server IP.
Run the following command to mount the shared directory from the NFS server to the local path /data
mkdir /data
# mount -t nfs $(NFS server IP):/nfsdata /data
mount -t nfs 192.168.100.105:/nfsdata /data
# Write a test file
echo "hello nfs server" > /data/test.txt
3.4 Check Test Results¶
On the NFS server, run the following command to verify that the file was written successfully
Successful test output: