New vTopology enhancement – display CSI version

I added a few enhancements to vTopology recently, notably the ability to display the details about the version and status of the vSphere CSI driver that is being used in a Kubernetes (K8s) deployment. I tested this on native K8s, vSphere with Tanzu TKG (Tanzu Kubernetes Grid) guest clusters, standalone TKG clusters as well as TKGI (formerly Enterprise PKS). Using the -csi option, you can now get details regarding the image versions, and also checks on the ready state of the CSI controller and CSI nodes.

This is the example take from a standalone TKG deployment. simply ensure that your K8s context is set correctly, and then add your vCenter credentials for the vSphere environment where K8s is running.

> pwsh ./vtopology/vtopology.ps1 -vc 10.27.51.106 -u administrator@vsphere.local -p *** -csi

*** This command is being run against the following Kubernetes configuration context: cormac-workload-admin@cormac-workload
*** To switch to another context, use the kubectl config use-context command ***

=== Found CSI Images:

csi-attacher:v2.0.0_vmware.1
vsphere-block-csi-driver:v2.0.0_vmware.1
csi-livenessprobe:v1.1.0_vmware.7
volume-metadata-syncer:v2.0.0_vmware.1
csi-provisioner:v1.4.0_vmware.2

Found a total of 5 CSI Images.

=== CSI Controller and Node checks

CSI Controller Status OK - Found 1 out of 1 CSI controllers ready
CSI Node Status OK - Found 4 out of 4 CSI nodes ready
CSI Node Status OK - CSI Node count 4 matches number of K8s nodes 

This next example is taken from a native upstream K8s deployment. It is running on the same vSphere environment as the previous example, but I have switched contexts to this K8s cluster.

> pwsh ./vtopology/vtopology.ps1 -vc 10.27.51.106 -u administrator@vsphere.local -p *** -csi

*** This command is being run against the following Kubernetes configuration context: kubernetes
*** To switch to another context, use the kubectl config use-context command ***

=== Found CSI Images:

csi-attacher:v2.0.0
csi-resizer:v0.3.0
driver:v2.0.0-rc.1-28-g766be8a
livenessprobe:v1.1.0
syncer:v2.0.0-rc.1-28-g766be8a
csi-provisioner:v1.4.0

Found a total of 6 CSI Images.

=== CSI Controller and Node checks

CSI Controller Status OK - Found 1 out of 1 CSI controllers ready
CSI Node Status ERROR - Found 4 out of 5 CSI nodes ready
CSI Node Status ERROR - CSI Node count 4 does not match number of K8s nodes 5

Here is an example taken from TKGI (formerly known as Enterprise PKS), which supports the CSI driver as of version 1.7. This output also includes additional details regarding a Persistent Volume (PV) which is another feature of vTopology:

# kubectl vtopology -vc 10.199.17.84 -u administrator@vsphere.local -p *** -pv pvc-b85fbd5f-908f-408c-a7c4-a54a7c30858b

*** This command is being run against the following Kubernetes configuration context:  pks-cluster-2-shared-t1
*** To switch to another context, use the kubectl config use-context command ***

=== vSphere Datastore information for PV pvc-b85fbd5f-908f-408c-a7c4-a54a7c30858b ===

      Datastore Name            :  vsanDatastore
      Datastore State           :  Available
      Datastore Type            :  vsan
      Datastore Capacity (GB)   :  7,154.00
      Datastore Free Space (GB) :  2,557.29

=== Virtual Machine Disk (VMDK) information for PV pvc-b85fbd5f-908f-408c-a7c4-a54a7c30858b ===

      VMDK Name          :  b901c3150f18437ebd83d975bacda18c.vmdk
      VMDK Type          :  Flat
      VMDK Capacity (GB) :  4
      VMDK Filename      :  [vsanDatastore] 9486615e-7263-9bf0-7a72-e4434b16755c/b901c3150f18437ebd83d975bacda18c.vmdk

=== Storage Policy (SPBM) information for PV pvc-b85fbd5f-908f-408c-a7c4-a54a7c30858b ===

      Kubernetes VM/Node :  vm-89c428cb-8d36-4074-97df-d4bfc9f32aaf
      Hard Disk Name     :  Hard disk 4
      Policy Name        :  vSAN Default Storage Policy
      Policy Compliance  :  compliant

=== Application (Pod) information for PV pvc-b85fbd5f-908f-408c-a7c4-a54a7c30858b ===

      Persistent Volume       :  pvc-b85fbd5f-908f-408c-a7c4-a54a7c30858b
      Persistent Volume Claim :  cassandra-data-cassandra-2
      Namespace               :  cassandra-csi
      Used by Pod             :  cassandra-2
      Attached to K8s Node    :  a36649d3-e0c8-4037-956b-75766e9890f8
      Attached to VM          :  vm-89c428cb-8d36-4074-97df-d4bfc9f32aaf

=== CSI Driver Information ===

      === Found CSI Images:

            csi-attacher:v1.1.1
            driver:v1.0.2
            livenessprobe:v1.1.0
            syncer:v1.0.2
            csi-provisioner:v1.2.2

      Found a total of 5 CSI Images.

      === CSI Controller and Node checks

            CSI Controller Status OK - Found 1 out of 1 CSI controllers ready
            CSI Node Status OK - Found 3 out of 3 CSI nodes ready
            CSI Node Status OK - CSI Node count 3 matches number of K8s nodes 3

As shown above, vTopology can be run as a standalone PowerShell script. However, it can also be ran as an extension to kubectl (i.e. kubectl vtopology) using the krew plugin method, as described in the readme. Feel free to try it out and let me know if you have any feedback or enhancement requests.

You can get vTopology from here.