You can skip this step if your Kubernetes cluster deployment is on a single VM.
When setting up a Kubernetes cluster, the folder /dockerdata-nfs must be shared between all of the Kubernetes nodes. This folder is used as a volume by the ONAP pods to share data, so there can only be one copy.
On this page we will attempt to do this by setting up an NFS server on the Kubernetes master node VM and then mount the exported directory on each of the Kubernetes nodes' VMs.
These instruction where written using VMs created from a ubuntu-16.04-server-cloudimg-amd64-disk1 image.
Create NFS Server and export /dockerdata-nfs on Kubernetes master node VM
The actual /dockerdata-nfs folder will live on the Kubernetes master node VM.
Create the directory as root on the Kubernetes master node VM.
sudo mkdir -p /dockerdata-nfs
The following has been validated in OpenStack environment (more details in Create an OpenStack Volume):
- create a OpenStack volume
- attach the volume to the Kubernetes master node VM
- mount the attached volume to directory /dockerdata-nfs on the Kubernetes master node VM
Setup the NFS server on the Kubernetes master node VM and export the dockerdata-nfs folder:
sudo apt update sudo apt install nfs-kernel-server sudo chmod 777 /export sudo chmod 777 /export/dockerdata-nfs sudo vi /etc/exports # append "/dockerdata-nfs *(rw,no_root_squash,no_subtree_check)" sudo vi /etc/fstab # append "/home/ubuntu/dockerdata-nfs /dockerdata-nfs none bind 0 0" sudo service nfs-kernel-server restart
Mount the dockerdata-nfs folder on each of the Kubernetes node VMs
On each of the other Kubernetes cluster node VMs, mount the /dockerdata-nfs folder that is being served from the Kubernetes master VM.
sudo apt install nfs-common sudo mkdir /dockerdata-nfs sudo chmod 777 /dockerdata-nfs sudo mount -t nfs -o proto=tcp,port=2049 <host|IP of k8s master node vm>:/dockerdata-nfs /dockerdata-nfs nfs auto 0 0:/dockerdata-nfs /dockerdata-nfs sudo vi /etc/fstab # append "<host|IP of k8s master node vm>:/dockerdata-nfs /dockerdata-nfs nfs auto 0 0"
Tips
unmount
Use the lazy (-l) option to force unmount the mount point.
For example,
sudo umount -l /dockerdata-nfs