Attaching NVIDIA GPU devices by using the NodePool resource

You can attach one or more NVIDIA graphics processing unit (GPU) devices to node pools by configuring the nodepool.spec.platform.kubevirt.hostDevices field in the NodePool resource.

Important

Attaching NVIDIA GPU devices to node pools is a Technology Preview feature only. Technology Preview features are not supported with Red Hat production service level agreements (SLAs) and might not be functionally complete. Red Hat does not recommend using them in production. These features provide early access to upcoming product features, enabling customers to test functionality and provide feedback during the development process.

For more information about the support scope of Red Hat Technology Preview features, see Technology Preview Features Support Scope.

Procedure
  • To attach a single GPU device, configure the NodePool resource by using the following example configuration:

    apiVersion: hypershift.openshift.io/v1beta1
    kind: NodePool
    metadata:
      name: <hosted_cluster_name>
      namespace: <hosted_cluster_namespace>
    spec:
      arch: amd64
      clusterName: <hosted_cluster_name>
      management:
        autoRepair: false
        upgradeType: Replace
      nodeDrainTimeout: 0s
      nodeVolumeDetachTimeout: 0s
      platform:
        kubevirt:
          attachDefaultNetwork: true
          compute:
            cores: <cpu>
            memory: <memory>
          hostDevices:
          - count: <count>
            deviceName: <gpu_device_name>
          networkInterfaceMultiqueue: Enable
          rootVolume:
            persistent:
              size: 32Gi
            type: Persistent
        type: KubeVirt
      replicas: <worker_node_count>
    • <hosted_cluster_name> specifies the name of your hosted cluster; for example, my-hosted-cluster.

    • <hosted_cluster_namespace> specifies the name of the hosted cluster namespace; for example, my-hc-namespace.

    • <cpu> specifies a value for CPU; for example, 2.

    • <memory> specifies a value for memory; for example, 16Gi.

    • <count> specifies the number of GPU devices you want to attach to each virtual machine (VM) in node pools. For example, if you attach 2 GPU devices to 3 node pool replicas, all 3 VMs in the node pool are attached to the 2 GPU devices. The default count is 1. The hostDevices field defines a list of different types of GPU devices that you can attach to node pools.

    • <gpu_device_name> specifies the GPU device name; for example,nvidia-a100.

    • <worker_node_count> specifies the worker count; for example, 3.

  • To attach multiple GPU devices, configure the NodePool resource by using the following example configuration:

    apiVersion: hypershift.openshift.io/v1beta1
    kind: NodePool
    metadata:
      name: <hosted_cluster_name>
      namespace: <hosted_cluster_namespace>
    spec:
      arch: amd64
      clusterName: <hosted_cluster_name>
      management:
        autoRepair: false
        upgradeType: Replace
      nodeDrainTimeout: 0s
      nodeVolumeDetachTimeout: 0s
      platform:
        kubevirt:
          attachDefaultNetwork: true
          compute:
            cores: <cpu>
            memory: <memory>
          hostDevices:
          - count: <count>
            deviceName: <gpu_device_name>
          - count: <count>
            deviceName: <gpu_device_name>
          - count: <count>
            deviceName: <gpu_device_name>
          - count: <count>
            deviceName: <gpu_device_name>
          networkInterfaceMultiqueue: Enable
          rootVolume:
            persistent:
              size: 32Gi
            type: Persistent
        type: KubeVirt
      replicas: <worker_node_count>
    • <hosted_cluster_name> specifies the name of your hosted cluster; for example, my-hosted-cluster.

    • <hosted_cluster_namespace> specifies the name of the hosted cluster namespace; for example, my-hc-namespace.

    • <cpu> specifies a value for CPU; for example, 2.

    • <memory> specifies a value for memory; for example, 16Gi.

    • <count> specifies the number of GPU devices you want to attach to each VM in node pools. For example, if you attach 2 GPU devices to 3 node pool replicas, all 3 VMs in the node pool are attached to the 2 GPU devices. The default count is 1. The hostDevices field defines a list of different types of GPU devices that you can attach to node pools.

    • <gpu_device_name> specifies the GPU device name; for example,nvidia-a100.

    • <worker_node_count> specifies the worker count; for example, 3.