More

GPU Operator and NVIDIA drivers

The ML scenarios section is being refined. Individual steps and examples may be added. If you have questions, contact the Shturval platform team.

This guide describes how to install the GPU Operator Delivered as a separate bundle, NVIDIA drivers, the nvidia runtime, and Fabric Manager on nodes with NVSwitch. It also describes how to check that the configuration is applied, add a GPU node, and prepare a node for cleanup.

How an NCI is structured: Node Configuration (NCI).


Before you start

The client cluster is already installed. Check:

  • the cluster has GPU nodes with an NVIDIA card;
  • the license includes Enterprise ML: Types of license — the license is required for the shturval_rpm_nvidia RPM repository;
  • every GPU node runs one kernel version. Otherwise the kernel-lt-devel package version in the NCI will not fit every node.

The CLI path needs kubectl, curl, gzip, grep, and sort.

  1. Open the client cluster.
  2. Administration → Manage nodes → the node page → Description: the kernel version. Save it. This is the value for the kernel-lt-devel / kernel-lt-headers packages.
  3. The version must be the same on every GPU node. If the versions differ, align the kernel first.
export KUBECONFIG_CLIENT=<path-to-the-client-cluster-kubeconfig>

kubectl --kubeconfig "${KUBECONFIG_CLIENT}" get nodes \
  -o custom-columns='NAME:.metadata.name,KERNEL:.status.nodeInfo.kernelVersion'

Match the node names to the GPU group and confirm that KERNEL is the same version on every GPU node.

How to carry the kernel version into the NCI:

SourceExampleWhat to put in the NCIWhere it is used
The Description block on the node page, or status.nodeInfo.kernelVersion5.15.178-1.el8.x86_645.15.178-1.el8 — the package version without the architecture suffix. Not 5.15 and not latestStep 2. Install NVIDIA components on the nodes, the version field of packages kernel-lt-devel and kernel-lt-headers in NCI nvidia-drivers

Load NVIDIA patches to the mirror

This step runs on the mirror host. Without it the cluster cannot download the gpu-operator chart and the driver RPMs.

sudo -i
cd /opt/mirror

Apply the archives from the delivery kit in this order:

ComponentWhat it adds to the mirror
NVIDIA driversNVIDIA driver RPMs and nvidia-container-toolkit
gpu-operatorthe GPU Operator Helm chart

For each archive:

rm -rf shturval-patch && mkdir shturval-patch
wget <archive-URL-from-the-delivery> -O shturval-patch/<file-name>.tgz
./stm patch apply
rm -rf shturval-patch

Take archive URLs only from the delivery kit.

Prepare parameters

ParameterRequiredPurposeWhere to get itWhere it is used
SHTURVAL_LICENSEYeslicense token for the shturval_rpm_nvidia RPM repositorythe Shturval license tokenStep 2, NCI nvidia-drivers, repository URL
<kernel-version>Yesversion of packages kernel-lt-devel and kernel-lt-headersthe node page, Description, or status.nodeInfo.kernelVersionStep 2, NCI nvidia-drivers
NVIDIA_DRIVER_VERSIONYesdriver package version that exists in shturval_rpm_nvidia. Available versions: 575.57.08 and 580.82.07the version list in the mirror — the command belowStep 2, NCI nvidia-drivers

Driver versions in the mirror:

NVIDIA_REPO_URL="$(kubectl --kubeconfig "${KUBECONFIG_CLIENT}" \
  get shturvalrepoconfigs shturval \
  -o jsonpath='{.spec.url}' | sed 's#shturval_helm#shturval_rpm_nvidia#' | sed 's#/$##')"

curl -fsSLk -u "user:${SHTURVAL_LICENSE}" "${NVIDIA_REPO_URL}/$(curl -fsSLk \
  -u "user:${SHTURVAL_LICENSE}" "${NVIDIA_REPO_URL}/repodata/repomd.xml" \
  | grep -oP '(?<=href=")[^"]*primary\.xml\.gz' | head -n 1)" \
| gzip -dc \
| grep -oP 'nvidia-driver-\K[0-9]+\.[0-9]+\.[0-9]+(?=-1\.red80\.x86_64\.rpm)' \
| sort -Vu

Step 1. Install the GPU Operator

The cluster must already have GPU nodes: the GPU Operator finds the NVIDIA card in PCI and sets the label nvidia.com/gpu.present=true. The driver and runtime NCIs select this label. If it is missing, nvidia-drivers stays at APPLIED 0/0.

Install the GPU Operator before the driver NCIs.

  1. Services and repositories → Available charts, repository shturval.
  2. Find the chart gpu-operator and click Install.
  3. Instance name: gpu-operator. Namespace: gpu-operator (create it if it does not exist). Mode: Auto, then Save.
  4. Wait until gpu-operator is installed.
  5. Check: Services and repositories → Installed services → gpu-operator → Manage: mode Auto, state Healthy.
  6. Administration → Manage nodes: nodes with an NVIDIA card have the label nvidia.com/gpu.present=true. If the label is missing, see troubleshooting.
kubectl --kubeconfig "${KUBECONFIG_CLIENT}" apply -f - <<'EOF'
apiVersion: ops.shturval.tech/v1beta2
kind: ShturvalServiceConfig
metadata:
  annotations:
    shturval.tech/description: NVIDIA GPU Operator creates/configures/manages GPUs atop Kubernetes
    shturval.tech/name: gpu-operator
  name: gpu-operator
spec:
  chart: gpu-operator
  mode: auto
  namespace: gpu-operator
  reponame: shturval
  version: 2.15.0
EOF

kubectl --kubeconfig "${KUBECONFIG_CLIENT}" get ssc gpu-operator
kubectl --kubeconfig "${KUBECONFIG_CLIENT}" get pods -n gpu-operator
kubectl --kubeconfig "${KUBECONFIG_CLIENT}" get nodes -L nvidia.com/gpu.present

Step 2. Install NVIDIA components on the nodes

Install the NVIDIA components on GPU nodes with an NCI.

Create three NCIs and one NFD rule. The NodeFeatureRule CRD (group nfd.k8s-sigs.io) is created together with the GPU Operator. The rule cannot be applied without it.

ObjectTypePriorityGUI sectionsSelectorWhat it does
nvidia-driversNCI90Package repositories, Kernel boot parameters (grub), Kernel modules, Packages to installnvidia.com/gpu.present=trueNVIDIA RPM repository, blacklist nouveau, kernel and driver packages, toolkit
nvidia-nvswitchNodeFeatureRule——PCI NVSwitch (vendor 10de, device 1ac2 / 1af1 / 22a3)NFD from the GPU Operator sets the label nvidia.com/nvswitch.present=true
nvidia-fabricmanagerNCI95Systemd unitsnvidia.com/nvswitch.present=trueenables the systemd unit nvidia-fabricmanager. On a GPU without NVSwitch the NCI is not applied
nvidia-runtime-minimalNCI100Container Runtime, Pluginsnvidia.com/gpu.present=truethe nvidia runtime in containerd

The license token is part of the repository URL authority: https://user:<token>@<mirror>/repository/shturval_rpm_nvidia. The kernel-lt-devel / kernel-lt-headers versions must match the node kernel. The manifest below uses 5.15.178-1.el8 as an example — substitute the version from your nodes. The nvidia-container-toolkit version is 1.18.0~rc.4.

  1. Open the client cluster.
  2. In the manifest below, substitute <license-token>, <mirror>, the kernel version, and <NVIDIA_DRIVER_VERSION>.
  3. Load all objects in one file: Importing manifests → paste the YAML → Check → Save.
apiVersion: node.shturval.tech/v1beta2
kind: NodeConfigItem
metadata:
  name: nvidia-drivers
spec:
  priority: 90
  repositories:
  - name: nvidia-repo
    description: "Shturval nvidia drivers repository"
    address: "https://user:<license-token>@<mirror>/repository/shturval_rpm_nvidia"
    state: present
  kernelarguments:
  - param: "modprobe.blacklist"
    value: "nouveau"
    exist: true
  kernelmodules:
  - autoload: false
    blacklist: true
    name: nouveau
  packages:
  - name: gcc
    setlock: false
    state: present
  - name: make
    setlock: false
    state: present
  - name: kernel-lt-devel
    setlock: false
    state: present
    version: "5.15.178-1.el8"
  - name: kernel-lt-headers
    setlock: false
    state: present
    version: "5.15.178-1.el8"
  - name: dkms-nvidia
    setlock: false
    state: present
    version: "<NVIDIA_DRIVER_VERSION>"
  - name: nvidia-driver
    setlock: false
    state: present
    version: "<NVIDIA_DRIVER_VERSION>"
  - name: nvidia-driver-cuda
    setlock: false
    state: present
    version: "<NVIDIA_DRIVER_VERSION>"
  - name: nvidia-modprobe
    setlock: false
    state: present
    version: "<NVIDIA_DRIVER_VERSION>"
  - name: nvidia-fabric-manager
    setlock: false
    state: present
    version: "<NVIDIA_DRIVER_VERSION>"
  - name: nvidia-container-toolkit
    setlock: false
    state: present
    version: 1.18.0~rc.4
  nodeconfigselector:
    nvidia.com/gpu.present: "true"
---
apiVersion: nfd.k8s-sigs.io/v1alpha1
kind: NodeFeatureRule
metadata:
  name: nvidia-nvswitch
spec:
  rules:
    - name: nvswitch-present
      labels:
        nvidia.com/nvswitch.present: "true"
      matchFeatures:
        - feature: pci.device
          matchExpressions:
            vendor:
              op: In
              value: ["10de"]
            device:
              op: In
              value:
                - "1ac2"  # V100 NVSwitch
                - "1af1"  # A100 NVSwitch
                - "22a3"  # H100/H200 NVSwitch
---
apiVersion: node.shturval.tech/v1beta2
kind: NodeConfigItem
metadata:
  name: nvidia-fabricmanager
spec:
  priority: 95
  systemdunits:
    - active: true
      enabled: true
      name: nvidia-fabricmanager
  nodeconfigselector:
    nvidia.com/nvswitch.present: "true"
---
apiVersion: node.shturval.tech/v1beta2
kind: NodeConfigItem
metadata:
  name: nvidia-runtime-minimal
spec:
  priority: 100
  runtimecfg:
    configSections:
      - path: 'plugins."io.containerd.grpc.v1.cri".containerd'
        params:
          - key: default_runtime_name
            value: "nvidia"
      - path: 'plugins."io.containerd.grpc.v1.cri".containerd.runtimes.nvidia'
        params:
          - key: privileged_without_host_devices
            value: false
          - key: runtime_type
            value: "io.containerd.runc.v2"
      - path: 'plugins."io.containerd.grpc.v1.cri".containerd.runtimes.nvidia.options'
        params:
          - key: BinaryName
            value: "/usr/bin/nvidia-container-runtime"
          - key: SystemdCgroup
            value: true
  nodeconfigselector:
    nvidia.com/gpu.present: "true"

If the NCIs are not applied, see troubleshooting.

Substitute <license-token>, <mirror>, the kernel version (the example uses 5.15.178-1.el8), and <NVIDIA_DRIVER_VERSION>, then run:

kubectl --kubeconfig "${KUBECONFIG_CLIENT}" apply -f - <<'EOF'
apiVersion: node.shturval.tech/v1beta2
kind: NodeConfigItem
metadata:
  name: nvidia-drivers
spec:
  priority: 90
  repositories:
  - name: nvidia-repo
    description: "Shturval nvidia drivers repository"
    address: "https://user:<license-token>@<mirror>/repository/shturval_rpm_nvidia"
    state: present
  kernelarguments:
  - param: "modprobe.blacklist"
    value: "nouveau"
    exist: true
  kernelmodules:
  - autoload: false
    blacklist: true
    name: nouveau
  packages:
  - name: gcc
    setlock: false
    state: present
  - name: make
    setlock: false
    state: present
  - name: kernel-lt-devel
    setlock: false
    state: present
    version: "5.15.178-1.el8"
  - name: kernel-lt-headers
    setlock: false
    state: present
    version: "5.15.178-1.el8"
  - name: dkms-nvidia
    setlock: false
    state: present
    version: "<NVIDIA_DRIVER_VERSION>"
  - name: nvidia-driver
    setlock: false
    state: present
    version: "<NVIDIA_DRIVER_VERSION>"
  - name: nvidia-driver-cuda
    setlock: false
    state: present
    version: "<NVIDIA_DRIVER_VERSION>"
  - name: nvidia-modprobe
    setlock: false
    state: present
    version: "<NVIDIA_DRIVER_VERSION>"
  - name: nvidia-fabric-manager
    setlock: false
    state: present
    version: "<NVIDIA_DRIVER_VERSION>"
  - name: nvidia-container-toolkit
    setlock: false
    state: present
    version: 1.18.0~rc.4
  nodeconfigselector:
    nvidia.com/gpu.present: "true"
---
apiVersion: nfd.k8s-sigs.io/v1alpha1
kind: NodeFeatureRule
metadata:
  name: nvidia-nvswitch
spec:
  rules:
    - name: nvswitch-present
      labels:
        nvidia.com/nvswitch.present: "true"
      matchFeatures:
        - feature: pci.device
          matchExpressions:
            vendor:
              op: In
              value: ["10de"]
            device:
              op: In
              value:
                - "1ac2"  # V100 NVSwitch
                - "1af1"  # A100 NVSwitch
                - "22a3"  # H100/H200 NVSwitch
---
apiVersion: node.shturval.tech/v1beta2
kind: NodeConfigItem
metadata:
  name: nvidia-fabricmanager
spec:
  priority: 95
  systemdunits:
    - active: true
      enabled: true
      name: nvidia-fabricmanager
  nodeconfigselector:
    nvidia.com/nvswitch.present: "true"
---
apiVersion: node.shturval.tech/v1beta2
kind: NodeConfigItem
metadata:
  name: nvidia-runtime-minimal
spec:
  priority: 100
  runtimecfg:
    configSections:
      - path: 'plugins."io.containerd.grpc.v1.cri".containerd'
        params:
          - key: default_runtime_name
            value: "nvidia"
      - path: 'plugins."io.containerd.grpc.v1.cri".containerd.runtimes.nvidia'
        params:
          - key: privileged_without_host_devices
            value: false
          - key: runtime_type
            value: "io.containerd.runc.v2"
      - path: 'plugins."io.containerd.grpc.v1.cri".containerd.runtimes.nvidia.options'
        params:
          - key: BinaryName
            value: "/usr/bin/nvidia-container-runtime"
          - key: SystemdCgroup
            value: true
  nodeconfigselector:
    nvidia.com/gpu.present: "true"
EOF

kubectl --kubeconfig "${KUBECONFIG_CLIENT}" get nci
kubectl --kubeconfig "${KUBECONFIG_CLIENT}" get nodes -L nvidia.com/gpu.present

How nodes get the drivers and the runtime

After the GPU Operator is installed, NFD runs on the nodes. It looks at PCI and, when it finds an NVIDIA card (vendor 10de), the node gets the label nvidia.com/gpu.present=true.

The shturval-node-config operator applies an NCI only to nodes that match the selector:

ResourceSelectorWhat it does
NCI nvidia-driversnvidia.com/gpu.present: "true"NVIDIA RPM repository, blacklist nouveau, kernel and driver packages, toolkit
NodeFeatureRule nvidia-nvswitchPCI NVSwitch (10de / 1ac2, 1af1, 22a3)label nvidia.com/nvswitch.present=true
NCI nvidia-fabricmanagernvidia.com/nvswitch.present: "true"enables the systemd unit nvidia-fabricmanager
NCI nvidia-runtime-minimalnvidia.com/gpu.present: "true"the nvidia runtime in containerd

The kernel-lt-devel and kernel-lt-headers versions in the driver NCI must match the kernel of every node the NCI applies to. Different kernel versions on GPU nodes are a common reason the packages fail.


A regular GPU and NVSwitch

Most GPU nodes only need the drivers and the runtime. Fabric Manager is required only where there is an NVSwitch (several GPUs on the node are connected through an NVIDIA switch).

  • No NVSwitch — NFD does not set nvidia.com/nvswitch.present. NCI nvidia-fabricmanager is not applied to that node and does not go to failed.
  • NVSwitch is present — the label appears, and the NCI enables nvidia-fabricmanager.

Do not enable Fabric Manager on every GPU node: on a machine without NVSwitch the systemd unit does not start.


Check after the GPU Operator is installed

If the GPU label is missing, first check pod state and events in the gpu-operator namespace.

See also: Troubleshooting.

If the NCI is applied but a GPU workload does not start, check the pod events:

kubectl describe pod -n <namespace> <pod-name>
kubectl get events -n <namespace> --sort-by=.lastTimestamp

A Notebook with a GPU: Troubleshooting.


Add a GPU node to a cluster that is already installed

GPU nodes can be added to the platform only through the Shturval v2 provider: physical hosts, not VMs of the main virtualization or cloud provider. You do not need to recreate the NCIs or the GPU Operator. The new node must match the same selectors.

  1. Add the GPU host to a Shturval v2 Worker group: adding hosts. If the client cluster runs on another provider (vSphere, oVirt, OpenStack, and so on), first create a separate Shturval v2 Worker group — Hybrid clusters.
  2. The OS kernel on the new node must match the kernel of the other GPU nodes.
  3. Wait until the GPU Operator / NFD sees the NVIDIA PCI device and the label nvidia.com/gpu.present=true appears.
  4. Check that the driver and runtime NCIs are applied to this node.
  5. If the node has an NVSwitch, also wait for the label nvidia.com/nvswitch.present=true and for nvidia-fabricmanager to be applied.

If the label does not appear, check NFD and whether the NVIDIA device is visible on the node.


Prepare a node for NVIDIA cleanup

If the node must be fully reconfigured, first stop new pods from being scheduled with Cordon, then evict workloads with Drain. Remove the NVIDIA packages and restore the containerd configuration by the procedure from your delivery.

Do not clean up a working node: removing containerd or damaging its configuration can leave the node NotReady until recovery is finished.