To achieve an automation of the storage provisioning in Kubernetes, we deploy our application using StatefulSet, and paired with Volume Claim Template. The backbone of Volume Claim Template is Storage Class.
A StorageClass provides a way for administrators to describe the “classes” of storage they offer. Different classes might map to quality-of-service levels, or to backup policies, or to arbitrary policies determined by the cluster administrators.
In https://kubernetes.io/docs/concepts/storage/storage-classes/, we see few storage class provisioners. The only issue here is that NFS provisioner is not available by default. Reason being, it is still under incubator phase.
Well, in this exercise, we will use that NFS provisioner and to our experience, it is mature enough to support production workload.
Refer to https://github.com/kubernetes-incubator/external-storage/tree/master/nfs-client, there are manual or HELM way to install NFS client provisioner. We are going to use HELM.
Since we are going to use HELM to install NFS client provisioner, let’s install HELM first.
Login to the primary rancher server and run this command:
sudo snap install helm --classic
Once you have Helm ready, you can add a chart repository. One popular starting location is the official Helm stable charts:
helm repo add stable https://kubernetes-charts.storage.googleapis.com/
NFS Client Storage Provisioner Installation
Install using the following command:
helm install nfs-share --set nfs.server=172.31.19.148 --set nfs.path=/mnt/nfs_share stable/nfs-client-provisioner
Verify the Storage Class is created
You have seen how we install NFS client provisioner as the storage class to automate the storage provisioning to be used in our Kafka cluster.