Tech ONTAP Blogs

Leveraging Fiber Channel Protocol with Trident 25.02 for Persistent Storage on OpenShift

banusundhar
NetApp
303 Views

In a previous blog post, I mentioned that the Trident 25.02 release supports provisioning block storage on ONTAP-based systems using the Fiber Channel (FC) protocol. In this post, I'll show you how to leverage the FC protocol to provision persistent storage for both containers and VMs on the OpenShift Container Platform.

 

Introduction

Prior to the Trident 25.02 release, users could provision block storage using iSCSI or NVMe/TCP protocols. However, many NetApp ONTAP customers run their workloads on VMware and have significant investments in Fiber Channel networks. With the Trident 25.02 release, these customers can modernize their platforms or applications while continuing to use their FC networks for storage provisioning. Let's see how this is done.

 

Prerequisites

For this example, I have an OpenShift cluster version 4.17 and have installed Trident 25.2.1 using the Red Hat certified Trident operator.

 

Step 1: Create a Trident Backend Configuration

First, create a Trident backend configuration file that specifies the FC protocol. Below is a sample tbc-fc.yaml file:

apiVersion: v1
kind: Secret
metadata:
  name: tbc-fc-secret
type: Opaque
stringData:
  username: admin
  password: <password>
---
apiVersion: trident.netapp.io/v1
kind: TridentBackendConfig
metadata:
  name: tbc-fc
spec:
  version: 1
  storageDriverName: ontap-san
  managementLIF: <cluster_mgmt_IP>
  backendName: tbc-fc
  svm: openshift-fc
  sanType: fcp
  storagePrefix: demofc
  defaults:
    nameTemplate: "{{ .config.StoragePrefix }}_{{ .volume.Namespace }}_{{ .volume.RequestName }}"
  credentials:
    name: tbc-fc-secret

Replace <password> and <cluster_mgmt_IP> with your actual credentials and cluster management IP address. Apply the backend configuration:

oc create -f tbc-fc.yaml -n trident

 

Step 2: Create a Storage Class

Next, create a storage class that uses the tbc-fc backend. Below is the sc-fc.yaml file:

apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: sc-fc
provisioner: csi.trident.netapp.io
parameters:
  backendType: "ontap-san"
  media: "ssd"
  provisioningType: "thin"
  fsType: ext4
  snapshots: "true"
allowVolumeExpansion: true


Apply the storage class configuration:
oc create -f sc-fc.yaml

 

Step 3: Create a VolumeSnapshotClass

Create a VolumeSnapshotClass to manage snapshots. Below is the snapshotclass.yaml file:

apiVersion: snapshot.storage.k8s.io/v1
kind: VolumeSnapshotClass
metadata:
  name: trident-snapshotclass
driver: csi.trident.netapp.io
deletionPolicy: Retain
Apply the volumeSnapshotClass  configuration:
oc create -f snapshotclass.yaml

 

Step 4: Set default storage class and volumeSnapshotClass

Set the sc-fc storage class to be the default storage class by setting the annotation:

storageclass.kubernetes.io/is-default-class: true

 

Also set the trident-snapshotclass to be the default snapshot class by setting the annotations as follows:

snapshot.storage.kubernetes.io/is-default-class: true

 

You can do the above either from the console or from the CLI. I have shown below screenshots when the settings are done from the console.

banusundhar_0-1744470713770.png

 

banusundhar_1-1744470733295.png

Here is the backend configuration, storage class and the volumeSnapshot class set in the cluster from the console:

banusundhar_2-1744470765298.png

 

Creating VMs on OpenShift Virtualization using Storage class san-fc

Install OpenShift Virtualization and from the user interface under Virtualization, click on Virtual machines to create a new VM.

Click on Create Virtual machine.

banusundhar_3-1744470816491.png

Select From template and then select the OS. If you pick the OS that says Source available, the golden image already available in the cluster is used to create a VM. For this example, click on Fedora VM.

banusundhar_4-1744470848352.png

 

Now, click on Customize VirtualMachine button. Use all the defaults on this page and click on CustomizeVirtualMachine.

banusundhar_5-1744470877749.png

Select the Disks tab. There is a rootdisk for this VM. Click on the 3 dots for this disk, and select edit. Note that the storage class is sc-fc (since it was set as the default).

banusundhar_6-1744470912505.png

Add another disk.(empty disk) and note that the storage class is automatically selected as sc-fc and Apply optimized StorageProfile settings is selected.

banusundhar_7-1744470942346.png

Note: The apply optimized StorageProfile settings ensures that the Access Mode is RWX and VolumeMode is Block. Trident supports RWX access mode in volume mode Block. RWX is required if you need to do Live migration of the VM from one node to another at a later point. 

banusundhar_8-1744470975607.png

 

Click on Create Virtual Machine.

banusundhar_9-1744471008367.png

The virtual machine goes from Provisioning to Starting to Running status.

Now, you can review the PVCs created for the VM either from the console or from the CLI. Here I am showing them using the CLI.

banusundhar_10-1744471085858.png

You can see that the storage class used for the pvcs is san-fc.

Now you can verify in the ONTAP storage system that the volume and the lun is created for each trident persistent volume of the VM.

Note: The volume name in ONTAP corresponding to the pv can be found by using the describe pv command.

banusundhar_11-1744471150563.png
banusundhar_12-1744471159845.png

 

Creating Applications on OpenShift Container Platform Using Storage Class sc-fc

Now that we have set up the backend configuration and storage class, let's create a PostgreSQL application that uses the sc-fc storage class for its persistent storage.

 

Step 1: Create a PostgreSQL Deployment

Create a postgres.yaml file with the following yaml:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: postgres
spec:
  replicas: 1
  selector:
    matchLabels:
      app: postgres
  template:
    metadata:
      labels:
        app: postgres
    spec:
      containers:
      - name: postgres
        image: postgres:14
        env:
        - name: POSTGRES_USER
          value: "admin"
        - name: POSTGRES_PASSWORD
          value: "adminpass"
        - name: POSTGRES_DB
          value: "mydb"
        - name: PGDATA
          value: "/var/lib/postgresql/data/pgdata"
        ports:
        - containerPort: 5432
        volumeMounts:
        - name: postgres-storage
          mountPath: /var/lib/postgresql/data
      volumes:
      - name: postgres-storage
        persistentVolumeClaim:
          claimName: postgres-pvc
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: postgres-pvc
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 5Gi
  storageClassName: sc-fc
---
apiVersion: v1
kind: Service
metadata:
  name: postgres
spec:
  selector:
    app: postgres
  ports:
  - protocol: TCP
    port: 5432
    targetPort: 5432
  type: ClusterIP

Apply the configuration to create the PostgreSQL deployment, PVC, and service:
oc apply -f postgres.yaml

 

Step 2: Verify the Deployment

After applying the configuration, verify that the PostgreSQL pod is running and that the PVC is bound. You can check the status using the following commands:

banusundhar_13-1744471281800.png

You can verify the volumes created in the ONTAP system using the ONTAP CLI as shown previously.

 

Conclusion

The Fiber Channel network is widely used by many customers, and the ability to use Trident to provision storage using the FC protocol is a significant benefit. This capability allows organizations to retain their investments in FC networks while modernizing their workloads or migrating VM workloads to modern container-based platforms like OpenShift.

 

NetApp continues to empower its customers by providing robust, enterprise-grade storage solutions that are easy to deploy and manage. Whether you're running modern application workloads or virtual machine workloads on OpenShift, the new Trident 25.02 offers a streamlined, efficient, and cost-effective way to enhance your storage capabilities.

 

By following the steps outlined in this post, you can leverage the Fiber Channel protocol to provision persistent storage for your applications and VMs on OpenShift, ensuring high performance and reliability for your critical workloads.

Public