Install an appropriate version of the vSphere Container Storage Plug-in in your native Kubernetes environment. After you install the plug-in, you can verify whether the installation is successful.

To deploy your Kubernetes cluster with topology aware provisioning feature, see Topology-Aware Volume Provisioning.

Prerequisites

Procedure

  1. Deploy vSphere Container Storage Plug-in.
    $ kubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/vsphere-csi-driver/v2.7.0/manifests/vanilla/vsphere-csi-driver.yaml
    Note: To be able to take advantage of the latest bug fixes and feature updates, make sure to use the most recent version of vSphere Container Storage Plug-in. For versions and updates, check VMware vSphere Container Storage Plug-in 2.7 Release Notes .
    If you deploy vSphere Container Storage Plug-in in a single control plane setup, you can edit the following field to change the number of replicas to one.
    If the driver is already deployed, use the kubectl edit command to reduce the number of replicas.
    kind: Deployment
    apiVersion: apps/v1
    metadata:
      name: vsphere-csi-controller
      namespace: vmware-system-csi
    spec:
      replicas: number_of_replicas
  2. Verify that the vSphere Container Storage Plug-in has been successfully deployed.
    1. Verify that vsphere-csi-controller instances run on the control plane node and vsphere-csi-node instances run on worker nodes of the cluster.
      $ kubectl get deployment --namespace=vmware-system-csi
      NAME                          READY   AGE
      vsphere-csi-controller        1/1     2m58s
      $ kubectl get daemonsets vsphere-csi-node --namespace=vmware-system-csi
      NAME               DESIRED   CURRENT   READY   UP-TO-DATE   AVAILABLE   NODE SELECTOR   AGE
      vsphere-csi-node   4         4         4       4            4           <none>          3m51s
    2. Verify that the vSphere Container Storage Plug-in has been registered with Kubernetes.
      $ kubectl describe csidrivers
        Name:         csi.vsphere.vmware.com
        Namespace:
        Labels:       <none>
        Annotations:  <none>
        API Version:  storage.k8s.io/v1
        Kind:         CSIDriver
        Metadata:
          Creation Timestamp:  2020-04-14T20:46:07Z
          Resource Version:    2382881
          Self Link:           /apis/storage.k8s.io/v1beta1/csidrivers/csi.vsphere.vmware.com
          UID:                 19afbecd-bc2f-4806-860f-b29e20df3074
        Spec:
          Attach Required:    true
          Pod Info On Mount:  false
          Volume Lifecycle Modes:
            Persistent
        Events:  <none>
    3. Verify that the CSINodes have been created.
      $ kubectl get CSINode
      NAME                 CREATED AT
      <k8s-worker1-name>   2020-04-14T12:30:29Z
      <k8s-worker2-name>   2020-04-14T12:30:38Z
      <k8s-worker3-name>   2020-04-14T12:30:21Z
      <k8s-worker4-name>   2020-04-14T12:30:26Z