Using the new vSphere Kubernetes Driver Operator with Red Hat OpenShift via Operator Hub
Tags: kubernetes, vmware, csi, driver
Published: 2022-01-18 08:51:30

---
title: Using the new vSphere Kubernetes Driver Operator with Red Hat OpenShift via Operator Hub
published: true
date: 2022-01-05 10:36:03 UTC
tags: Kubernetes,VMware,CSI,Driver
canonical_url: https://veducate.co.uk/vsphere-kubernetes-operator-openshift/#utm_source=rss&utm_medium=rss&utm_campaign=vsphere-kubernetes-operator-openshift
---

##### What is the vSphere Kubernetes Driver Operator (VDO)?

This Kubernetes Operator has been designed and created as part of the [VMware and IBM Joint Innovation Labs program](https://blogs.vmware.com/cloud/2019/09/05/ibm-vmware-make-mark-one-kind-joint-innovation-lab/). We also talked about this at [VMworld 2021 in a joint session with IBM and Red Hat](https://www.vmware.com/vmworld/en/video-library/search.html#text=%22MCL3142S%22&year=2021). With the aim of simplifying the deployment and lifecycle of VMware Storage and Networking Kubernetes driver plugins on any Kubernetes platform, including Red Hat OpenShift.

This vSphere Kubernetes Driver Operator (VDO) exposes custom resources to configure the CSI and CNS drivers, and using Go Lang based CLI tool, introduces validation and error checking as well. Making it simple for the Kubernetes Operator to deploy and configure.

The Kubernetes Operator currently covers the following existing CPI, CSI and CNI drivers, which are separately maintained projects found on GitHub.

- [vSphere Cloud Provider](https://github.com/kubernetes/cloud-provider-vsphere)
- [vSphere CSI Storage Driver](https://github.com/kubernetes-sigs/vsphere-csi-driver)

This operator will remain CNI agnostic, therefore CNI management will not be included, and for example [Antrea already has an operator.](https://github.com/vmware/antrea-operator-for-kubernetes)

- [vSphere Antrea CNI Driver](https://github.com/vmware-tanzu/antrea)

Below is the high level architecture, you can read a more [detailed deep dive here](https://github.com/vmware-tanzu/vsphere-kubernetes-drivers-operator/blob/main/docs/architecture/vdo-architecture.md).

[![vSphere Kubernetes Drivers Operator - Architecture Topology](https://i0.wp.com/veducate.co.uk/wp-content/uploads/2021/12/vSphere-Kubernetes-Drivers-Operator-Architecture-Topology.png?resize=604%2C379&ssl=1)](https://i0.wp.com/veducate.co.uk/wp-content/uploads/2021/12/vSphere-Kubernetes-Drivers-Operator-Architecture-Topology.png?ssl=1)

##### Installation Methods

You have two main installation methods, which will also affect the pre-requisites below.

If using Red Hat OpenShift, you can install the Operator via [Operator Hub](https://catalog.redhat.com/software/operators/detail/617828032bfbc00e94ed953b#deploy-instructions) as this is a certified Red Hat Operator. You can also configure the CPI and CSI driver installations via the UI as well.

Alternatively, you can install the manual way and use the vdoctl cli tool, this method would also be your route if using a Vanilla Kubernetes installation.

This blog post will cover the UI method using Operator Hub.

##### Pre-requisites

Kubernetes and vSphere environment must meet the following:

- vSphere 6.7U3(or later) is supported for VDO
- Virtual Machine hardware version should be version 15(or later)
- Enable Disk UUID(disk.EnableUUID) on all node vm’s
- K8s master nodes should be able to communicate with vCenter management interface
- Disable Swap(swapoff -a) on all Kubernetes nodes at the Guest Operating System level.

[![Enable Disk UUID - disk.EnableUUID - on all node vms](https://i1.wp.com/veducate.co.uk/wp-content/uploads/2021/12/Enable-Disk-UUID-disk.EnableUUID-on-all-node-vms.png?resize=604%2C325&ssl=1)](https://i1.wp.com/veducate.co.uk/wp-content/uploads/2021/12/Enable-Disk-UUID-disk.EnableUUID-on-all-node-vms.png?ssl=1)

If you are going to deploy this on a Vanilla Kubernetes instance or want to use the CLI tooling:

Clone the [VDO GitHub Repo](https://github.com/vmware-tanzu/vsphere-kubernetes-drivers-operator) or download the files from the [release page.](https://github.com/vmware-tanzu/vsphere-kubernetes-drivers-operator/releases) This installation method will be covered separately in another blog post.

```
git clone https://github.com/vmware-tanzu/vsphere-kubernetes-drivers-operator
```

Install Go, so that we can use the vdoctl command line tool.

- https://go.dev/doc/install

###### Installing and configuring the vSphere Kubernetes Driver Operator

###### Installation via Red Hat Operator Hub UI

- Create a project to install the Operator into.
  - In this example I have used “vsphere-kubernetes-drivers-operator” and will match the below SecurityContext example

[![openshift - create project namespace](https://i1.wp.com/veducate.co.uk/wp-content/uploads/2021/12/openshift-create-project-namespace.png?resize=604%2C176&ssl=1)](https://i1.wp.com/veducate.co.uk/wp-content/uploads/2021/12/openshift-create-project-namespace.png?ssl=1)

- Create the Security Context Constraint, so that the Service Account can access the relevant resources.
  - Administration > Custom Resource Definitions > SecurityContextConstraints > Instance > Create

[![openshift - create security context constraint - scc](https://i0.wp.com/veducate.co.uk/wp-content/uploads/2021/12/openshift-create-security-context-constraint-scc.png?resize=604%2C462&ssl=1)](https://i0.wp.com/veducate.co.uk/wp-content/uploads/2021/12/openshift-create-security-context-constraint-scc.png?ssl=1)

```
# Example SCC [Source and further details](https://github.com/vmware-tanzu/vsphere-kubernetes-drivers-operator/blob/main/docs/getting-started/getting-started-from-operator-hub.md#pre-requisites)
# Used for CSI 2.3.0 and later, ensure the namespace in bold below matches the one you have created earlier

apiVersion: security.openshift.io/v1
kind: SecurityContextConstraints
metadata:
  name: example
allowPrivilegedContainer: true
allowHostDirVolumePlugin: true
allowHostNetwork: true
allowHostPorts: true
defaultAddCapabilities:
- SYS_ADMIN
runAsUser:
  type: RunAsAny
seLinuxContext:
  type: RunAsAny
fsGroup:
  type: RunAsAny
users:
- system:serviceaccount: **vsphere-kubernetes-drivers-operator** :vdo-controller-manager
- system:serviceaccount:vmware-system-csi:vsphere-csi-node
```

[![openshift - create security context constraint - provide YAML](https://i1.wp.com/veducate.co.uk/wp-content/uploads/2021/12/openshift-create-security-context-constraint-provide-YAML.png?resize=604%2C542&ssl=1)](https://i1.wp.com/veducate.co.uk/wp-content/uploads/2021/12/openshift-create-security-context-constraint-provide-YAML.png?ssl=1)

Now we will install the Operator.

- Go to OperatorHub and search for “vsphere-kubernetes-driver-operator”
- Click the Operator to install it
- Ensure it is installed to the namespace you have created, where the SCC is linked.

```
Note: I recommend that you ensure you are installing/running Operator version 0.1.5 or higher. This blog post used 0.1.3 in some of the images. However, a number of enhancements were introduced, and I upgraded to 0.1.5 part way through (see [this section for upgrades](https://veducate.co.uk/vsphere-kubernetes-operator-openshift#Performing_upgrades_of_the_Operator_and_deployed_CPICSI))
```

[![openshift - operatorhub - install vsphere-kubernetes-driver-operator](https://i2.wp.com/veducate.co.uk/wp-content/uploads/2021/12/openshift-operatorhub-install-vsphere-kubernetes-driver-operator.png?resize=604%2C424&ssl=1)](https://i2.wp.com/veducate.co.uk/wp-content/uploads/2021/12/openshift-operatorhub-install-vsphere-kubernetes-driver-operator.png?ssl=1) [![openshift - operatorhub - installing vsphere-kubernetes-driver-operator](https://i0.wp.com/veducate.co.uk/wp-content/uploads/2021/12/openshift-operatorhub-installing-vsphere-kubernetes-driver-operator.png?resize=604%2C255&ssl=1)](https://i0.wp.com/veducate.co.uk/wp-content/uploads/2021/12/openshift-operatorhub-installing-vsphere-kubernetes-driver-operator.png?ssl=1)

Once completed, click to view the Operator, and we will continue to configure the drivers.

[![openshift - operatorhub - installed vsphere-kubernetes-driver-operator](https://i1.wp.com/veducate.co.uk/wp-content/uploads/2021/12/openshift-operatorhub-installed-vsphere-kubernetes-driver-operator.png?resize=604%2C262&ssl=1)](https://i1.wp.com/veducate.co.uk/wp-content/uploads/2021/12/openshift-operatorhub-installed-vsphere-kubernetes-driver-operator.png?ssl=1)

###### Configuring the CPI and CSI via the Operator in the OpenShift Cluster UI

You will need the following pieces of information

- IP address or FQDN of vCenter
  - If using a secure connection to the vCenter, you will need to provide the SSL thumbprint
- Credentials for the vCenter with the [appropriate permissions](https://docs.vmware.com/en/VMware-vSphere-Container-Storage-Plug-in/2.0/vmware-vsphere-csp-getting-started/GUID-043ACF65-9E0B-475C-A507-BBBE2579AA58.html).
- Datacenter(s) Names within the vCenter. This is required by CPI and CSI to manage the cluster

We now need to create a source secret to hold our credentials for our vCenter.

- In the OpenShift Cluster UI > Workloads > Secrets
- Ensure you are in the namespace of “kube-system”
- Create > Source Secret

[![openshift - Create Source Secret with vCenter credentials](https://i1.wp.com/veducate.co.uk/wp-content/uploads/2021/12/openshift-Create-Source-Secret-with-vCenter-credentials.jpg?resize=604%2C221&ssl=1)](https://i1.wp.com/veducate.co.uk/wp-content/uploads/2021/12/openshift-Create-Source-Secret-with-vCenter-credentials.jpg?ssl=1)

- Provide a name for the secret
- Authentication type should be set to “basic”
- Provide the username and password and click create

[![openshift - Create Source Secret with vCenter credentials 2](https://i1.wp.com/veducate.co.uk/wp-content/uploads/2021/12/openshift-Create-Source-Secret-with-vCenter-credentials-2.jpg?resize=604%2C590&ssl=1)](https://i1.wp.com/veducate.co.uk/wp-content/uploads/2021/12/openshift-Create-Source-Secret-with-vCenter-credentials-2.jpg?ssl=1)

Go back to the Installed Operators Page, set the namespace where you installed the operator and select it.

First we will create the vSphere Cloud Config, which is the connection and credential data for our vCenter.

Click Create Instance under “VsphereCloudConfig”

[![openshift - installed operators - vsphere-kubernetes-drivers-operator - vspherecloudconfig create instance](https://i1.wp.com/veducate.co.uk/wp-content/uploads/2021/12/openshift-installed-operators-vsphere-kubernetes-drivers-operator-vspherecloudconfig-create-instance.jpg?resize=604%2C295&ssl=1)](https://i1.wp.com/veducate.co.uk/wp-content/uploads/2021/12/openshift-installed-operators-vsphere-kubernetes-drivers-operator-vspherecloudconfig-create-instance.jpg?ssl=1)

- Provide a name for the configuration and any labels as necessary.
- Credentials – provide the name of the source secret created earlier in the kube-system namespace
- Provide your datacenter names
- Select Insecure configuration if necessary
  - If unticked, you need to provide a thumbprint for the vCenter SSL
- VC IP – you can provide either IP or FQDN here.

Click create.

[![openshift - vspherecloudconfig create instance](https://i2.wp.com/veducate.co.uk/wp-content/uploads/2021/12/openshift-vspherecloudconfig-create-instance.jpg?resize=604%2C921&ssl=1)](https://i2.wp.com/veducate.co.uk/wp-content/uploads/2021/12/openshift-vspherecloudconfig-create-instance.jpg?ssl=1)

[![openshift - vspherecloudconfig instance created](https://i2.wp.com/veducate.co.uk/wp-content/uploads/2021/12/openshift-vspherecloudconfig-instance-created.jpg?resize=604%2C203&ssl=1)](https://i2.wp.com/veducate.co.uk/wp-content/uploads/2021/12/openshift-vspherecloudconfig-instance-created.jpg?ssl=1)

We will now configure the VDOConfig, which will control which drivers are deployed and the credentials to use.

Click to create a VDOConfig instance.

[![openshift - installed operators - vsphere-kubernetes-drivers-operator - vdoconfig create instance](https://i2.wp.com/veducate.co.uk/wp-content/uploads/2021/12/openshift-installed-operators-vsphere-kubernetes-drivers-operator-vdoconfig-create-instance.jpg?resize=604%2C324&ssl=1)](https://i2.wp.com/veducate.co.uk/wp-content/uploads/2021/12/openshift-installed-operators-vsphere-kubernetes-drivers-operator-vdoconfig-create-instance.jpg?ssl=1)

- Provide a name for the configuration and any labels as necessary.
- Then open the Storage Provider heading.

[![openshift - vdoconfig create instance](https://i2.wp.com/veducate.co.uk/wp-content/uploads/2021/12/openshift-vdoconfig-create-instance.jpg?resize=604%2C566&ssl=1)](https://i2.wp.com/veducate.co.uk/wp-content/uploads/2021/12/openshift-vdoconfig-create-instance.jpg?ssl=1)

- Provide the vSphere Cloud Config instance name we have just created
- Provide the ClusterDistribution Name – for this blog it will of course be OpenShift
- But remember this VDO is available for any vanilla K8s setup
- Provide a custom kubelet path if applicable
- Provide configuration for VSAN File Services volumes access if applicable

[![openshift - vdoconfig create instance - storage provider](https://i0.wp.com/veducate.co.uk/wp-content/uploads/2021/12/openshift-vdoconfig-create-instance-storage-provider.jpg?resize=604%2C502&ssl=1)](https://i0.wp.com/veducate.co.uk/wp-content/uploads/2021/12/openshift-vdoconfig-create-instance-storage-provider.jpg?ssl=1)

Now open the Cloud Provider configuration. If you have already installed the cloud provider in your environment, you do not need to configure this section. However, the Cloud Provider is a mandatory requirement to be installed when using the vSphere CSI Driver. So, if you don’t have it installed already, install it as part of this configuration.

- Provide any topology information if applicable. You can read more about deploying the vSphere CSI and CPI in a [topology aware mode here](https://docs.vmware.com/en/VMware-vSphere-Container-Storage-Plug-in/2.0/vmware-vsphere-csp-getting-started/GUID-73D106A3-1D8A-4CDC-9762-6CB35A65B0B4.html#GUID-73D106A3-1D8A-4CDC-9762-6CB35A65B0B4).
- Provide the name for the vSphere Cloud Config
- Click Create

[![openshift - vdoconfig create instance - cloud provider](https://i0.wp.com/veducate.co.uk/wp-content/uploads/2021/12/openshift-vdoconfig-create-instance-cloud-provider.jpg?resize=604%2C583&ssl=1)](https://i0.wp.com/veducate.co.uk/wp-content/uploads/2021/12/openshift-vdoconfig-create-instance-cloud-provider.jpg?ssl=1)

[![openshift - vdoconfig instance](https://i2.wp.com/veducate.co.uk/wp-content/uploads/2021/12/openshift-vdoconfig-instance.jpg?resize=604%2C203&ssl=1)](https://i2.wp.com/veducate.co.uk/wp-content/uploads/2021/12/openshift-vdoconfig-instance.jpg?ssl=1)

You can monitor the Operator performing its actions by going to the “vdo-controller-manager” pod, and viewing the logs from the “manager” container.

[![openshift - vdo manager logs](https://i2.wp.com/veducate.co.uk/wp-content/uploads/2021/12/openshift-vdo-manager-logs.jpg?resize=604%2C312&ssl=1)](https://i2.wp.com/veducate.co.uk/wp-content/uploads/2021/12/openshift-vdo-manager-logs.jpg?ssl=1)

Below you can see the reconciler has picked up the configuration instances and is now attempting to install the CPI. You can follow the logs for the full status.

[![openshift - vdo manager logs - installing CPI](https://i1.wp.com/veducate.co.uk/wp-content/uploads/2022/01/openshift-vdo-manager-logs-installing-CPI.jpg?resize=604%2C343&ssl=1)](https://i1.wp.com/veducate.co.uk/wp-content/uploads/2022/01/openshift-vdo-manager-logs-installing-CPI.jpg?ssl=1)

Another Option is to view the VDOConfig instance in the Operator to see the status.

[![openshift - vsphere kubernetes driver operator - vdoconfig instance yaml](https://i0.wp.com/veducate.co.uk/wp-content/uploads/2022/01/openshift-vsphere-kubernetes-driver-operator-vdoconfig-instance-yaml.jpg?resize=544%2C776&ssl=1)](https://i0.wp.com/veducate.co.uk/wp-content/uploads/2022/01/openshift-vsphere-kubernetes-driver-operator-vdoconfig-instance-yaml.jpg?ssl=1)

Once completed, you can check the status of the Pods for the configured CPI and CSI via the UI in the highlighted projects, kube-system for CPI, vmware-system-csi for CSI.

Or by running the following command:

```
# CPI
oc get pods -l k8s-app=vsphere-cloud-controller-manager

# CSI
oc get pods -n vmware-system-csi
```

###### [![openshift - CPI and CSI pods running](https://i0.wp.com/veducate.co.uk/wp-content/uploads/2022/01/openshift-CPI-and-CSI-pods-running.jpg?resize=604%2C491&ssl=1)](https://i0.wp.com/veducate.co.uk/wp-content/uploads/2022/01/openshift-CPI-and-CSI-pods-running.jpg?ssl=1)

###### Testing and validating the installation

To test the installation, we will configure a StorageClass and then a Persistent Volume Claim.

- To go StorageClasses under Storage
- Click Create StorageClass

[![openshift - create storage class](https://i2.wp.com/veducate.co.uk/wp-content/uploads/2022/01/openshift-create-storage-class.jpg?resize=604%2C227&ssl=1)](https://i2.wp.com/veducate.co.uk/wp-content/uploads/2022/01/openshift-create-storage-class.jpg?ssl=1)

Either use the form to fill in, and select the provisioner as “csi.vmware.com” or use the “Edit YAML” view and paste in your configuration such as the below [example.](https://github.com/saintdle/vSphere-CSI-Driver-2.0-OpenShift-4/blob/master/Example-SC%2BPVC/csi-sc-vmc-example.yaml)

```
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
  name: csi-sc-vmc
  annotations:
    storageclass.kubernetes.io/is-default-class: "false"
provisioner: csi.vsphere.vmware.com
parameters:
  StoragePolicyName: "vSAN Default Storage Policy"
  datastoreURL: "ds:///vmfs/volumes/vsan:3672d400f5fa4515-8a8cb78f6b972f74/"
```

[![openshift - create storage class - edit yaml example](https://i0.wp.com/veducate.co.uk/wp-content/uploads/2022/01/openshift-create-storage-class-edit-yaml-example.jpg?resize=604%2C329&ssl=1)](https://i0.wp.com/veducate.co.uk/wp-content/uploads/2022/01/openshift-create-storage-class-edit-yaml-example.jpg?ssl=1)

To create a Persistent Volume Claim (PVC)

- Under Storage navigation heading select PersistentVolumeClaims
- Click Create PersistentVolumeClaim

[![openshift - create persistent volume claim](https://i0.wp.com/veducate.co.uk/wp-content/uploads/2022/01/openshift-create-persistent-volume-claim.jpg?resize=604%2C163&ssl=1)](https://i0.wp.com/veducate.co.uk/wp-content/uploads/2022/01/openshift-create-persistent-volume-claim.jpg?ssl=1)

Provide the necessary details, such as selecting your Storage Class and the correct Volume mode. Again you have the ability to use the “Edit YAML” option and provide the configuration such as the below [example](https://github.com/saintdle/vSphere-CSI-Driver-2.0-OpenShift-4/blob/master/Example-SC%2BPVC/csi-pvc-example.yaml#L1):

```
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: veducate-blog-test-pvc
  labels:
    name: veducate-blog-test-pvc
  annotations:
    volume.beta.kubernetes.io/storage-class: veducate-csi
spec:
  accessModes:
  - ReadWriteOnce
  resources:
    requests:
      storage: 1Gi

```

And we are looking for a status of Bound.

[![openshift - persistent volume claim - status bound](https://i0.wp.com/veducate.co.uk/wp-content/uploads/2022/01/openshift-persistent-volume-claim-status-bound.jpg?resize=604%2C403&ssl=1)](https://i0.wp.com/veducate.co.uk/wp-content/uploads/2022/01/openshift-persistent-volume-claim-status-bound.jpg?ssl=1)

###### Performing upgrades of the Operator and deployed CPI/CSI

The operator will follow the upgrade option you provided during install, either automatically when a new version is released, or manually. You can [read more about this behaviour](https://docs.openshift.com/container-platform/4.9/operators/admin/olm-upgrading-operators.html) on the Red Hat OpenShift Documentation site.

The CPI and CSI will be installed and aligned to the compatibility matrix in use. You can check which file is in use by going to:

- Workloads > Config Maps > Ensure you are in the vSphere Kubernetes Driver Operator namespace > compat-matrix-config

[![openshift - vsphere kubernetes driver operator - compability matrix configuration.](https://i1.wp.com/veducate.co.uk/wp-content/uploads/2022/01/openshift-vsphere-kubernetes-driver-operator-compability-matrix-configuration.-.jpg?resize=604%2C370&ssl=1)](https://i1.wp.com/veducate.co.uk/wp-content/uploads/2022/01/openshift-vsphere-kubernetes-driver-operator-compability-matrix-configuration.-.jpg?ssl=1)

Drivers can be updated by updating the compatibility matrix using the following command:

```
vdoctl update compatibility-matrix <path-to-updated-compat-matrix>

# Existing pods of CloudProvider and StorageProvider are terminated and new pods are spawned according to the compatible versions of CSI and CPI

# You can either provide your own file, such as one which is edited with the locations of your own modified vSphere CSI deployment files, or a later file from the [GitHub Repo releases page.](https://github.com/vmware-tanzu/vsphere-kubernetes-drivers-operator/releases)
```

##### Summary

This new operator does what it sets out to achieve, to simplify the deployment, configuration and lifecycle of the vSphere Kubernetes Drivers. And for the Red Hat OpenShift customers, it’s fully supported and certified.

The VMware team have made the tooling and ability to consume this new “Master Operator of the Drivers” flexible in terms of consumption, and simple.

Regards

[Follow @Saintdle](https://twitter.com/saintdle)<script async="" src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>

[Dean Lewis](https://uk.linkedin.com/in/saintdle?trk=profile-badge)

The post [Using the new vSphere Kubernetes Driver Operator with Red Hat OpenShift via Operator Hub](https://veducate.co.uk/vsphere-kubernetes-operator-openshift/) appeared first on [vEducate.co.uk](https://veducate.co.uk).