Tip |
---|
You can skip this step if your Kubernetes cluster deployment is on a single VM. |
...
On this page we will attempt to do this by setting up an NFS server on one of the Kubernetes node VM Master and then mount the exported shared directory on every other all Kubernetes nodes' VMs.
These instruction where written using VMs created from a ubuntu-16.04-server-cloudimg-amd64-disk1 image.
Any user can be used to run the steps in this page, as all the commands are "sudo".
Table of Contents |
---|
On the NFS Server VM (Kubernetes Master)
The actual /dockerdata-nfs folder will live on one of the Kubernetes nodes' VMs Kubernetes Master node which will also be running the NFS server to export this folder.
Choose one VM, from the to-be-Kubernetes node VMs, to be the NFS server and execute the steps in this section on this VM.
Set up the /dockerdata-nfs Folder
Choose one of the following to create the /dockerdata-nfs folder on this VM:
Use local directory | Run the following command as root:
| |||||
---|---|---|---|---|---|---|
Use separate volume | Following instruction from Create an OpenStack Volume to: (where the VM Instance is the one that you have chosen) |
Setup the NFS Server and Export /dockerdata-nfs Folder
...
Code Block | ||||
---|---|---|---|---|
| ||||
sudo apt update sudo apt install nfs-kernel-server sudo vi /etc/exports # append the following # /dockerdata-nfs *(rw,no_root_squash,no_subtree_check) sudo vi /etc/fstab # append the following # /home/ubuntu/dockerdata-nfs /dockerdata-nfs none bind 0 0 sudo service nfs-kernel-server restart |
Expand | ||
---|---|---|
| ||
$ ps -ef|grep nfs |
On the
...
other VMs (Kubernetes Nodes)
Mount the /dockerdata-nfs Folder
On each of the other Kubernetes cluster node VMsnodes, mount the /dockerdata-nfs folder that is being served from the NFS server.
Code Block | ||||
---|---|---|---|---|
| ||||
sudo apt update sudo apt install nfs-common sudo mkdir /dockerdata-nfs sudo chmod 777 /dockerdata-nfs # Option 1: sudo mount -t nfs -o proto=tcp,port=2049 <hostname or <host|IP address of NFS server>:/dockerdata-nfs /dockerdata-nfs sudo vi /etc/fstab # append the following #<hostname of <host|IP address of NFS server>:/dockerdata-nfs /dockerdata-nfs nfs auto 0 0 # Option 2: # (verified on Ubuntu 16.04 AWS EC2 EBS volume) sudo vi /etc/fstab # append the following # cdrancher.onap.info:/dockerdata-nfs /dockerdata-nfs nfs auto 0 0 sudo mount -a |
Tips
...
Verify it :
Tocuh a file inside /dockerdata-nfs directory on the Kubernetes Master and check to see if the same file is found under /dockerdata-nfs on all Kubernetes nodes.
Unmount the share directory
Use the lazy (-l) option on Kubernetes nodes to force unmount the mount point.
...