Demystifying CSI plug-in for PowerFlex (persistent volumes) with Red Hat OpenShift
Tue, 20 Oct 2020 12:16:04 -0000
|Read Time: 0 minutes
Raghvendra Tripathi
SunilKumar HS
The Container Storage Interface (CSI) is a standard for exposing file and block storage to containerized workloads on Kubernetes, OpenShift and so on. CSI helps third-party storage providers (for example PowerFlex) to write plugins for OpenShift to consume storage from backends as persistent storage.
CSI architecture
CSI driver for Dell EMC VxFlex OS can be installed using Dell EMC Storage CSI Operator. It is a community operator and can be deployed using OperatorHub.io.
Master nodes components do not communicate directly with CSI driver. It interacts only with API server on Master nodes. It MUST watch the Kubernetes API and trigger the appropriate CSI operations against it. Kubelet discovers CSI drivers using kubelet plug-in registration mechanism. It directly issues calls to CSI driver.
CSI components
External Provisioner –The CSI external provisioner is a sidecar container that watches the k8s API server for PersistentVolumeClaim objects. It calls CreateVolume against the specified CSI endpoint to provision a volume.
External Attacher – The CSI external attacher is a sidecar container that watches the API server for VolumeAttachment objects and triggers controller [Publish|Unpublish] volume operations against a CSI endpoint.
Driver Registrar
- Node-driver-registrar – The CSI node driver registrar is a sidecar container that fetches driver information from a CSI endpoint and registers it with the kubelet on that node.
- Cluster-driver-registrar – The CSI cluster driver registrar is a sidecar container that registers a CSI driver with a k8s cluster by creating a CSIDriver object.
CSI Controller plug-in – The controller component can be deployed as a Deployment or StatefulSet on any node in the cluster. It consists of the CSI driver that implements the CSI Controller service.
CSI Identity – It enables k8s components and CSI containers to identify the driver.
CSI Node Plugin –The node component should be deployed on every node in the cluster through a DaemonSet. It consists of the CSI driver that implements the CSI Node service and the node driver registrar sidecar container.
CSI and Persistent Storage
Storage within OpenShift Container Platform 4.x is managed from worker nodes. The CSI API uses two new resources: PersistentVolume (PV) and PersistentVolumeClaim (PVC) objects.
Persistent Volumes – Kubernetes provides physical storage devices to the cluster in the form of objects called Persistent Volumes.
apiVersion: v1 kind: PersistentVolume spec: accessModes: - ReadWriteOnce capacity: storage: 104Gi claimRef: apiVersion: v1 kind: PersistentVolumeClaim name: test-vol namespace: powerflex . . csi: driver: csi-vxflexos.dellemc.com fsType: ext4
persistentVolumeReclaimPolicy: Delete storageClassName: powerflex-vxflexos volumeMode: Filesystem status: phase: Bound |
Persistent Volume Claim – This object lets pods use storage from Persistent Volumes.
kind: PersistentVolumeClaim apiVersion: v1 metadata: name: test-vol namespace: powerflex spec: accessModes: - ReadWriteOnce volumeMode: Filesystem resources: requests: storage: 100Gi storageClassName: powerflex-vxflexos |
Storage Class – This object helps you create PV/PVC pair for pods. It stores information about creating a persistent volume.
apiVersion: storage.dell.com/v1 kind: CSIVXFlexOS spec: storageClass: - name: powerflexos - key: csi-vxflexos.dellemc.com/X_CSI_VXFLEXOS_SYSTEMNAME values: - csi-vxflexos.dellemc.com . . . - name: powerflex-xfs parameters: storagepool: pool2 FsType: xfs allowedTopologies: - matchLabelExpressions: - key: csi-vxflexos.dellemc.com/X_CSI_VXFLEXOS_SYSTEMNAME values: - csi-vxflexos.dellemc.com |
CSI driver capabilities
Static Provisioning – This allows you to manually make existing PowerFlex storage available to the cluster.
Dynamic Provisioning - Storage volumes can be created on-demand. Storage resources are dynamically provisioned using the provisioner that is specified by the StorageClass object.
Retain Reclaiming – Once PersistentVolumeClaim is deleted, the corresponding PersistentVolume is not deleted rather moved to Released state and its data can be manually recovered.
Delete Reclaiming – It is the default reclaim policy and unlike Retain policy persistent volume is deleted.
Access Mode - ReadWriteOnce -- the volume can be mounted as read/write by a single node.
Supported FS - ext4/xfs.
Raw Block Volumes: Using Raw block option, PV can be attached to pod or app directly without formatting with ext4 or xfs file system.