When you use vSphere IaaS control plane, you can check health status of a persistent volume in a bound state.

For each persistent volume in a bound state, the health status appears in the Annotations: volumehealth.storage.kubernetes.io/messages: field of the persistent volume claim bound to the persistent volume. Two possible values for health status exist.
Health Status Description
Accessible The persistent volume is accessible and available for use.
Inaccessible The persistent volume is inaccessible and cannot be used. The persistent volume becomes inaccessible if the datastore that stores the volume cannot be reached by the hosts that connect to the datastore.

To monitor volume health status in the vSphere Client, see Monitor and Manage Persistent Volumes.

Procedure

  1. Access your namespace in the vSphere IaaS control plane environment.
  2. Create a persistent volume claim.
    1. Create a YAML file that contains the persistent volume claim configuration.
      apiVersion: v1
      kind: PersistentVolumeClaim
      metadata:
        name: my-pvc
      spec:
        accessModes:
          - ReadWriteOnce
        storageClassName: gold
        resources:
          requests:
              storage: 2Gi
                 
    2. Apply the persistent volume claim to the Kubernetes cluster.
      kubectl apply -f pvc_name.yaml
      This command creates a Kubernetes persistent volume and a vSphere volume with a backing virtual disk that satisfies the claim's storage requirements.
    3. Check whether the persistent volume claim is bound to a volume.
      kubectl get pvc my-pvc

      The output shows that the persistent volume claim and the volume are in the bound state.

      NAME     STATUS    VOLUME   CAPACITY   ACCESSMODES   STORAGECLASS   AGE
      my-pvc   Bound     my-pvc   2Gi        RWO           gold           30s
  3. Check the health status of the volume.
    Run the following command to check the volume health annotation of the persistent volume claim bound to the persistent volume.
    kubectl describe pvc my-pvc

    In the following sample output, the volumehealth.storage.kubernetes.io/messages field shows the health status as accessible.

    Name:          my-pvc
    Namespace:     test-ns
    StorageClass:  gold
    Status:        Bound
    Volume:        my-pvc
    Labels:        <none>
    Annotations:   pv.kubernetes.io/bind-completed: yes
                   pv.kubernetes.io/bound-by-controller: yes
                   volume.beta.kubernetes.io/storage-provisioner: csi.vsphere.vmware.com
                   volumehealth.storage.kubernetes.io/messages: accessible
    Finalizers:    [kubernetes.io/pvc-protection]
    Capacity:      2Gi
    Access Modes:  RWO
    VolumeMode:    Filesystem