This document will show you how to simply deploy the NFS shared storage service on your Kubernetes cluster with an example.
Choose one of your nodes to install the NFS service, assuming our shared data directory is: /data/k8s
$ systemctl stop firewalld.service $ systemctl disable firewalld.service
$ yum -y install nfs-utils rpcbind
$ chmod 755 /data/k8s/
/etc/exports
. Add the following configuration information to the file:$ vi /etc/exports /data/k8s *(rw,sync,no_root_squash)
$ systemctl start rpcbind.service $ systemctl enable rpcbind $ systemctl status rpcbind ··· Sep 16 10:27:19 master systemd[1]: Started RPC bind service.
If you see the above output, the rpcbind is successfully started.
$ systemctl start nfs.service $ systemctl enable nfs $ systemctl status nfs ··· Sep 16 10:28:01 master systemd[1]: Started NFS server and services.
If you see the above output, the NFS server is successfully started.
It can also be confirmed by the following command:
$ rpcinfo -p | grep nfs 100003 3 tcp 2049 nfs 100003 4 tcp 2049 nfs 100227 3 tcp 2049 nfs_acl 100003 3 udp 2049 nfs 100003 4 udp 2049 nfs 100227 3 udp 2049 nfs_acl
So here we have the NFS server installed, then we install the NFS service on the other nodes.
Install NFS on the other nodes of your Kubernetes cluster:
$ systemctl stop firewalld.service $ systemctl disable firewalld.service
$ yum -y install nfs-utils rpcbind
$ systemctl start rpcbind.service $ systemctl enable rpcbind.service $ systemctl start nfs.service $ systemctl enable nfs.service
$ showmount -e 192.168.130.32 Export list for 192.168.130.32: /data/k8s *
Where 192.168.130.32
is the node IP where your NFS server is located.
For further verification operations, please see NFS Storage Preparation Document