OpenEBS: Read Write Many volumes on kubernetes.

One may reason to use kubernetes is for scaling. This is normally archived by configuration the kubernetes deployment in the way that when the cpu or memory load come to hight, more pods are created (distributed along the nodes). This works very great, until we begin to use OpenEBS to store and serve files. The problem about OpenEBS and similary dynamic storage provisioners is, that they only provide rwo (read write once) volumes. So, when we create replication pods on other nodes, this pods can not write on the volumes and, depending on our configuration, not even read on them.

A solution for this problem, is to use a NFS server. So that the the architecture would look something like this:

Install helm (packet manager)

We will use the kubeernetes packet manager named helm to install the NFS server. You can install helm on a ubuntu (server or laptop) using snap:

snap install helm

Then make sure that .kube/config is present

ls ~/.kube/config 

Finally init helm

helm init

Install the NFS server

First, if you do not allreay have installed OpenEBS, do the follwowing:

helm upgrade openebs stable/openebs \
  --install \
  --namespace openebs \
  -f https://openebs.github.io/charts/helm-values-0.7.0.yaml \
  --version 0.7.1;

kubectl apply -f https://raw.githubusercontent.com/openebs/openebs/v0.7/k8s/openebs-storageclasses.yaml

Second, install nfs (client) on every worker node:

apt-get update
apt-get install nfs-common

Finally, install the NFS server:

helm upgrade nfs-server-provisioner stable/nfs-server-provisioner \
  --install
  --namespace kube-system
  --set persistence.enabled=true
  --set persistence.storageClass="openebs-standard"
  --set persistence.size=8Gi
  --set storageClass.defaultClass=true