14.2.2.3. Running a storage checkup by using the CLI


Use a predefined checkup to verify that the OpenShift Container Platform cluster storage is configured optimally to run OpenShift Virtualization workloads.

Prerequisites

  • You have installed the OpenShift CLI (oc).
  • The cluster administrator has created the required cluster-reader permissions for the storage checkup service account and namespace, such as in the following example:

    apiVersion: rbac.authorization.k8s.io/v1
    kind: ClusterRoleBinding
    metadata:
      name: kubevirt-storage-checkup-clustereader
    roleRef:
      apiGroup: rbac.authorization.k8s.io
      kind: ClusterRole
      name: cluster-reader
    subjects:
    - kind: ServiceAccount
      name: storage-checkup-sa
      namespace: <target_namespace> 
    1
    1
    The namespace where the checkup is to be run.

Procedure

  1. Create a ServiceAccount, Role, and RoleBinding manifest file for the storage checkup.

    Example service account, role, and rolebinding manifest:

    ---
    apiVersion: v1
    kind: ServiceAccount
    metadata:
      name: storage-checkup-sa
    ---
    apiVersion: rbac.authorization.k8s.io/v1
    kind: Role
    metadata:
      name: storage-checkup-role
    rules:
      - apiGroups: [ "" ]
        resources: [ "configmaps" ]
        verbs: ["get", "update"]
      - apiGroups: [ "kubevirt.io" ]
        resources: [ "virtualmachines" ]
        verbs: [ "create", "delete" ]
      - apiGroups: [ "kubevirt.io" ]
        resources: [ "virtualmachineinstances" ]
        verbs: [ "get" ]
      - apiGroups: [ "subresources.kubevirt.io" ]
        resources: [ "virtualmachineinstances/addvolume", "virtualmachineinstances/removevolume" ]
        verbs: [ "update" ]
      - apiGroups: [ "kubevirt.io" ]
        resources: [ "virtualmachineinstancemigrations" ]
        verbs: [ "create" ]
      - apiGroups: [ "cdi.kubevirt.io" ]
        resources: [ "datavolumes" ]
        verbs: [ "create", "delete" ]
      - apiGroups: [ "" ]
        resources: [ "persistentvolumeclaims" ]
        verbs: [ "delete" ]
    ---
    apiVersion: rbac.authorization.k8s.io/v1
    kind: RoleBinding
    metadata:
      name: storage-checkup-role
    subjects:
      - kind: ServiceAccount
        name: storage-checkup-sa
    roleRef:
      apiGroup: rbac.authorization.k8s.io
      kind: Role
      name: storage-checkup-role
  2. Apply the ServiceAccount, Role, and RoleBinding manifest in the target namespace:

    $ oc apply -n <target_namespace> -f <storage_sa_roles_rolebinding>.yaml
  3. Create a ConfigMap and Job manifest file. The config map contains the input parameters for the checkup job.

    Example input config map and job manifest:

    ---
    apiVersion: v1
    kind: ConfigMap
    metadata:
      name: storage-checkup-config
      namespace: $CHECKUP_NAMESPACE
    data:
      spec.timeout: 10m
      spec.param.storageClass: ocs-storagecluster-ceph-rbd-virtualization
      spec.param.vmiTimeout: 3m
    ---
    apiVersion: batch/v1
    kind: Job
    metadata:
      name: storage-checkup
      namespace: $CHECKUP_NAMESPACE
    spec:
      backoffLimit: 0
      template:
        spec:
          serviceAccount: storage-checkup-sa
          restartPolicy: Never
          containers:
            - name: storage-checkup
              image: quay.io/kiagnose/kubevirt-storage-checkup:main
              imagePullPolicy: Always
              env:
                - name: CONFIGMAP_NAMESPACE
                  value: $CHECKUP_NAMESPACE
                - name: CONFIGMAP_NAME
                  value: storage-checkup-config
  4. Apply the ConfigMap and Job manifest file in the target namespace to run the checkup:

    $ oc apply -n <target_namespace> -f <storage_configmap_job>.yaml
  5. Wait for the job to complete:

    $ oc wait job storage-checkup -n <target_namespace> --for condition=complete --timeout 10m
  6. Review the results of the checkup by running the following command:

    $ oc get configmap storage-checkup-config -n <target_namespace> -o yaml

    Example output config map (success):

    apiVersion: v1
    kind: ConfigMap
    metadata:
      name: storage-checkup-config
      labels:
        kiagnose/checkup-type: kubevirt-storage
    data:
      spec.timeout: 10m
      status.succeeded: "true" 
    1
    
      status.failureReason: "" 
    2
    
      status.startTimestamp: "2023-07-31T13:14:38Z" 
    3
    
      status.completionTimestamp: "2023-07-31T13:19:41Z" 
    4
    
      status.result.cnvVersion: 4.20.2 
    5
    
      status.result.defaultStorageClass: trident-nfs 
    6
    
      status.result.goldenImagesNoDataSource: <data_import_cron_list> 
    7
    
      status.result.goldenImagesNotUpToDate: <data_import_cron_list> 
    8
    
      status.result.ocpVersion: 4.20.0 
    9
    
      status.result.pvcBound: "true" 
    10
    
      status.result.storageProfileMissingVolumeSnapshotClass: <storage_class_list> 
    11
    
      status.result.storageProfilesWithEmptyClaimPropertySets: <storage_profile_list> 
    12
    
      status.result.storageProfilesWithSmartClone: <storage_profile_list> 
    13
    
      status.result.storageProfilesWithSpecClaimPropertySets: <storage_profile_list> 
    14
    
      status.result.storageProfilesWithRWX: |-
        ocs-storagecluster-ceph-rbd
        ocs-storagecluster-ceph-rbd-virtualization
        ocs-storagecluster-cephfs
        trident-iscsi
        trident-minio
        trident-nfs
        windows-vms
      status.result.vmBootFromGoldenImage: VMI "vmi-under-test-dhkb8" successfully booted
      status.result.vmHotplugVolume: |-
        VMI "vmi-under-test-dhkb8" hotplug volume ready
        VMI "vmi-under-test-dhkb8" hotplug volume removed
      status.result.vmLiveMigration: VMI "vmi-under-test-dhkb8" migration completed
      status.result.vmVolumeClone: 'DV cloneType: "csi-clone"'
      status.result.vmsWithNonVirtRbdStorageClass: <vm_list> 
    15
    
      status.result.vmsWithUnsetEfsStorageClass: <vm_list> 
    16
    1
    Specifies if the checkup is successful (true) or not (false).
    2
    The reason for failure if the checkup fails.
    3
    The time when the checkup started, in RFC 3339 time format.
    4
    The time when the checkup has completed, in RFC 3339 time format.
    5
    The OpenShift Virtualization version.
    6
    Specifies if there is a default storage class.
    7
    The list of golden images whose data source is not ready.
    8
    The list of golden images whose data import cron is not up-to-date.
    9
    The OpenShift Container Platform version.
    10
    Specifies if a PVC of 10Mi has been created and bound by the provisioner.
    11
    The list of storage profiles using snapshot-based clone but missing VolumeSnapshotClass.
    12
    The list of storage profiles with unknown provisioners.
    13
    The list of storage profiles with smart clone support (CSI/snapshot).
    14
    The list of storage profiles spec-overriden claimPropertySets.
    15
    The list of virtual machines that use the Ceph RBD storage class when the virtualization storage class exists.
    16
    The list of virtual machines that use an Elastic File Store (EFS) storage class where the GID and UID are not set in the storage class.
  7. Delete the job and config map that you previously created by running the following commands:

    $ oc delete job -n <target_namespace> storage-checkup
    $ oc delete config-map -n <target_namespace> storage-checkup-config
  8. Optional: If you do not plan to run another checkup, delete the ServiceAccount, Role, and RoleBinding manifest:

    $ oc delete -f <storage_sa_roles_rolebinding>.yaml
Red Hat logoGithubredditYoutubeTwitter

자세한 정보

평가판, 구매 및 판매

커뮤니티

Red Hat 소개

Red Hat은 기업이 핵심 데이터 센터에서 네트워크 에지에 이르기까지 플랫폼과 환경 전반에서 더 쉽게 작업할 수 있도록 강화된 솔루션을 제공합니다.

보다 포괄적 수용을 위한 오픈 소스 용어 교체

Red Hat은 코드, 문서, 웹 속성에서 문제가 있는 언어를 교체하기 위해 최선을 다하고 있습니다. 자세한 내용은 다음을 참조하세요.Red Hat 블로그.

Red Hat 문서 정보

Legal Notice

Theme

© 2026 Red Hat
맨 위로 이동