Try   HackMD

Installing kubernetes-csi/csi-driver-nfs on OpenShift with the Console

We have an existing way to do this with the cli but I wanted to show how we can also do it with the OpenShift Console

Create a HelmRepository

  1. Log into the OpenShift console and change to the Developer Perspective

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More β†’

  1. Click Helm on the left navigation bar

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More β†’

  1. Change Project to kube-system

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More β†’

  1. Create a new Helm Chart Repository

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More β†’

  1. Leave it as a Namespaced scoped type
  • Set Name: csi-driver-nfs
  • Optionally set Display Name: csi-driver-nfs
  • Set URL: https://raw.githubusercontent.com/kubernetes-csi/csi-driver-nfs/master/charts

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More β†’

  1. Create the Repository
  2. Click Helm again and Create a new Helm Release

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More β†’

  1. Filter by Chart Repositories and select Csi Driver Nfs and select the Csi Driver Nfs chart card to install

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More β†’

  1. Click Create

These notes were created using version csi-driver-nfs version 4.6.0

  1. Change the Chart version to v4.6.0
  2. With the YAML view of the release options we need to change a few settings:
controller:
...
  runOnControlPlane: false    # change to true
...
externalSnapshotter:
  customResourceDefinitions:
    enabled: true             # change to false
  enabled: false              # change to true
  1. Click Create
  2. All three circles will go dark blue as the Helm Release rolls out the containers to the cluster

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More β†’

We are deploying into the kube-system project because the csi-driver-nfs needs elevated permissions on the OpenShift cluster which are provided by default in that privileged project

Create a StorageClass

  1. Proceed to the Administrator Perspective in the

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More β†’

  1. Navigate to Storage -> StorageClasses and click Create StorageClass

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More β†’

  1. Use the GUI to set:
  • Name: nfs-csi
  • Reclaim policy: Delete
  • Volume binding mode: Immediate
  • Provisioner: nfs.csi.k8s.io
  • Additional parameters:
    • server: nfs-server.example.com
    • share: /example-dir
    • subDir: ${pvc.metadata.namespace}-${pvc.metadata.name}

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More β†’

If we need specific mount options like NFS v4 we can add a parameter:

  • mountOptions: nvsvers=4.1

subDir is optional, by default the template for subdirectories is {nfs-server-address}#{sub-dir-name}#{share-name}

Set Default StorageClass

If we do not have one already we should set this StorageClass as default for the cluster

  1. Click Actions -> Edit Annotations

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More β†’

  1. Set a new annotation
  • storageclass.kubernetes.io/is-default-class: true

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More β†’

  1. Click Save

Now you can provision a new PersistentVolumeClaim!

Create a VolumeSnapshotClass

Snapshots are supported with csi-driver-nfs after creating a VolumeSnapshotClass. Creating snapshots and clones can be slow because a snapshot request simply runs tar -czf $DESTINATION_FILE $SOURCE_FOLDER. More information can be found in the community discussion. If you want fast/instantaneous snapshots and clones, please use your storage vendor's CSI driver (e.g. NetApp, Dell/EMC, Portworx, OpenShift Data Foundation, etc…)

A basic VolumeSnapshotClass only requires two pieces of information.

--- apiVersion: snapshot.storage.k8s.io/v1 kind: VolumeSnapshotClass deletionPolicy: Delete driver: nfs.csi.k8s.io #Required to be nfs.csi.k8s.io metadata: name: csi-driver-nfs #Any name is OK

Virtual Machine snapshots have a 5 minute timeout by default. The GUI allows you to manually specify a longer time. Or you can create VM snapshots via YAML with failureDeadline set to a large number.

--- apiVersion: snapshot.kubevirt.io/v1alpha1 kind: VirtualMachineSnapshot metadata: name: snapshot-with-60-minute-timeout namespace: my-amazing-namespace spec: failureDeadline: 1h0m0s # Make this long enough to allow tar to finish source: apiGroup: kubevirt.io kind: VirtualMachine name: my-amazing-vm