Before you begin

The following are required to install the helm chart:

  1. One separate VM or a bare metal server
  2. OpenShift cluster on VMware vSphere cluster
  3. The Helm tool (v3+)
  4. The oc tool
  5. Storage class

StorageClass configuration

Skip this section if you have already configured the NFS StorageClass.

A ‘StorageClass’ allows your k8s administrators to describe the “classes” of storage they offer. The StorageClass contains the fields provisioner, parameters, and reclaimPolicy, which are used when a PersistentVolume (PV) belonging to the class needs to be dynamically provisioned.

For using the PersistenceVolume, you must first deploy an Network File System (NFS) helm chart. Deploying the NFS helm chart will automatically create a custom StorageClass.

Installing the NFS for the OpenShift cluster

If you do not use NFS for storage then you can skip this section.

This charts installs a custom storage class into a OpenShift cluster using the Helm package manager. It also installs an NFS client provisioner into the cluster which dynamically creates persistent volumes from a single NFS share.

  • The repository for the nfs helm chart is given below:

  • For deploying the helm chart, the nfs server and nfs mount path are required
  • Before installing the NFS Provisioner helm chart, you need to add a stable helm repository to your helm client as shown below:

helm repo add stable

  • To install the chart with the deploy name nfs-client, run the following command:

helm install nfs-client --set nfs.server=x.x.x.x --set nfs.path=/exported/path stable/nfs-client-provisioner

An appropriate scc(security context constraints) should be assigned to the nfs-provisioners service account. However, we have used the default scc hostmount-anyuid.

oc get serviceaccount

oc get sa

oc adm policy add-scc-to-user hostmount-anyuid -z nfs-provisioner-nfs-client-provisioner

To apply the scc on the nfs-client-provisioner, the deployment should be scaled down to 0 and again scaled up to 1

oc get deployments
oc scale deployments nfs-provisioner-nfs-client-provisioner --replicas=0
oc scale deployments nfs-provisioner-nfs-client-provisioner --replicas=1
oc get pods

oc get deployments

  • The nfs-client storage class must be marked with the default annotation so that the PersistentVolumeClaim objects (without a StorageClass specified) will trigger dynamic provisioning:

oc patch storageclass nfs-client -p '{"metadata": {"annotations":{"":"true"}}}'

  • After deploying the nfs helm chart, execute the command:

oc get storageclass

get sc

Next Step