You are viewing documentation for KubeSphere version:v3.0.0
KubeSphere v3.0.0 documentation is no longer actively maintained. The version you are currently viewing is a static snapshot. For up-to-date documentation, see the latest version.
Set up an NFS Server
KubeSphere supports NFS-client Provisioner as a storage plugin. In order to use it, you must configure the NFS server in advance. With the NFS server in place, an NFS client mounts a directory on the server machine so that files residing on the NFS server are accessible to the NFS client. Namely, you need to create and export a directory that your client machine can access.
Once your NFS server machine is ready, you can use KubeKey to install NFS-client Provisioner by Helm charts together with Kubernetes and KubeSphere. The exported directory of your NFS server must be provided in your Chart configurations used by KubeKey during installation.
Note
This tutorial demonstrates how to install the NFS server on Ubuntu 16.04 as an example.
Install and Configure an NFS Server
Step 1: Install the NFS kernel server
To set up your server machine, you must install the NFS kernel server on it.
-
Run the following command so that you will be using the latest package on Ubuntu for installation.
sudo apt-get update
-
Install the NFS kernel server.
sudo apt install nfs-kernel-server
Step 2: Create an export directory
Your NFS client will mount a directory on the server machine which has been exported by the NFS server.
-
Run the following command to specify a mount folder name (for example,
/mnt/demo
).sudo mkdir -p /mnt/demo
-
For demonstration purposes, remove restrictive permissions of the folder so that all your clients can access the directory.
sudo chown nobody:nogroup /mnt/demo
sudo chmod 777 /mnt/demo
Step 3: Grant your client machine access to the NFS server
-
Run the following command:
sudo nano /etc/exports
-
Add your client information to the file.
/mnt/demo clientIP(rw,sync,no_subtree_check)
If you have multiple client machines, you can add them all in the file. Alternatively, specify a subnet in the file so that all the clients within it can access the NFS server. For example:
/mnt/demo 192.168.0.0/24(rw,sync,no_subtree_check)
Note
rw
: Read and write operations. The client machine will have both read and write access to the volume.sync
: Changes will be written to disk and memory.no_subtree_check
: Prevent subtree checking. It disables the security verification required for a client to mount permitted subdirectories.
-
Save the file when you finish editing it.
Step 4: Apply the configuration
-
Run the following command to export your shared directory.
sudo exportfs -a
-
Restart the NFS kernel server.
sudo systemctl restart nfs-kernel-server