Skip to content
ImagineWorld

Advanced Workloads, PCI Devices and Performance

node_idnode-book_mastering-suse-harvester_chapter-10-advanced-workloads-pci-devices-and-performance
node_typechapter-node
schema_profileworld.chapter_node.v1
statusactive
entropyhigh
manifoldworld
domainimagineworld.net
authorityinforms
layercorpus
chapter_num10
chapter_titleAdvanced Workloads, PCI Devices and Performance
governed_byCORPUS
constitutional_citationCONSTITUTION
local graph

Chapter 10: Advanced Workloads, PCI Devices And Performance

Section titled “Chapter 10: Advanced Workloads, PCI Devices And Performance”

Harvester can run the usual mix of Linux and Windows VMs, utility services and guest Kubernetes clusters without anything special. At some point though, you need to host workloads that push the hardware harder. That can mean VMs that need direct access to PCI devices, networks that rely on SR IO V NICs, GPU hungry AI stacks that want either full GPUs or vGPU slices, databases that are sensitive to storage latency, or low jitter trading or telecom applications that will expose any sloppy configuration.

Harvester is built on KVM, KubeVirt and Longhorn, so most of the advanced tuning techniques you might know from general virtualization or Kubernetes also apply. The difference is that Harvester gives you first class support for PCI passthrough, NVIDIA vGPU through SR IO V capable GPUs, a storage stack you can tune, and a built in monitoring pipeline based on Prometheus and Grafana.

This section walks through concrete patterns. You will see how PCI passthrough and SR IO V devices look in Harvester, how GPU and vGPU configuration works with NVIDIA tooling, how to think about performance tuning for storage and latency sensitive VMs, and how to get a useful observability setup for Harvester and Longhorn instead of guessing when users complain that things feel slow.

10.1: PCI Passthrough And SR IO V Devices For VMs

Section titled “10.1: PCI Passthrough And SR IO V Devices For VMs”

Harvester treats PCI devices as first class objects. A PCI device on a host, identified by its PCI address, is represented as a PCIDevice custom resource. The pcidevices controller addon discovers these devices and keeps them in sync with what is physically present in each node. The same controller lets you pass devices directly through to VMs by creating PCIDeviceClaim resources, or by enabling passthrough in the Harvester UI.

The core idea is that the device is removed from host control and given to a single VM. The VM then owns that device, including driver installation and firmware interactions. The Harvester documentation stresses this for GPUs and NICs in particular. Once a device is passed through, the hypervisor does not virtualize it. Performance and feature exposure look very close to bare metal from inside the guest.

Before Harvester can use PCI passthrough, you must make sure the hosts are configured correctly. That means enabling VT d or AMD IOMMU in firmware and adding the appropriate kernel parameters so that the Linux host exposes IOMMU groups. In practice, administrators add parameters such as intel_iommu=on or amd_iommu=on to the boot configuration and reboot nodes, then confirm via lspci and /sys/kernel/iommu_groups that devices are grouped as expected. Community guides on GPU passthrough with Harvester walk through these checks in detail, because incorrect IOMMU configuration is the most common cause of passthrough failures.

Once the host side is healthy, the pcidevices controller discovers PCI devices and creates PCIDevice objects. To assign one of those devices to a VM, you create a PCIDeviceClaim. The CRD for claims lives in the devices.harvesterhci.io/v1beta1 API group. The pci passthrough operator documentation shows a typical claim resource.

apiVersion: devices.harvesterhci.io/v1beta1
kind: PCIDeviceClaim
metadata:
name: prod-gpu-claim-01
spec:
pciAddress: "0000:65:00.0"
nodeName: "hv-node-01"

This object states that the PCI device at address 0000:65:00.0 on node hv-node-01 is being claimed. The pcidevices controller updates status once the claim is bound and also patches the KubeVirt configuration so that this claim can be attached to a VM. If the device is removed or the claim is misconfigured, you see errors in the controller logs and the VM will fail to start with host device errors, as some bug reports illustrate.

The VM itself references the PCI device through its KubeVirt specification. Harvester manages much of this mapping automatically when you add a PCI device in the VM edit screen, but it helps to understand how it appears at the YAML level. A simplified VirtualMachine with a PCI host device might look like this.

apiVersion: kubevirt.io/v1
kind: VirtualMachine
metadata:
name: gpu-worker-01
namespace: ai-prod
spec:
running: true
template:
metadata:
labels:
kubevirt.io/domain: gpu-worker-01
workload: ai-training
spec:
domain:
cpu:
cores: 16
resources:
requests:
memory: 64Gi
devices:
hostDevices:
- name: pci-gpu0
deviceName: prod-gpu-claim-01
disks:
- name: rootdisk
disk:
bus: virtio
volumes:
- name: rootdisk
persistentVolumeClaim:
claimName: pvc-gpu-worker-01-root

The important part here is the hostDevices section. The deviceName corresponds to a permitted host device entry that the pcidevices controller configured when it processed the PCIDeviceClaim. The trained eye will notice that Harvester usually adds more details and annotations in real manifests, but this snippet conveys the relationship.

For SR IO V, the pattern is similar but the background is different. A SR IO V capable NIC exposes multiple virtual functions that each appear as separate PCI devices. The Harvester team points out that SR IO V NICs can expose virtual functions as PCI devices, which Harvester then attaches to VMs using the same passthrough mechanism.

On the host, you first enable SR IO V in firmware and kernel, then configure the number of VFs for each NIC by writing to its iov_numvfs sysfs entry. Those VFs appear as PCI devices and are picked up by the pcidevices controller. From that point on, each VF can be claimed by a VM using PCIDeviceClaim. The outcome is a VM with a direct VF NIC, which looks like a real NIC to the guest OS and participates in VLANs and QoS policies just like a physical port, assuming your switch configuration is consistent.

When you design PCI passthrough, you also have to think about failure domains. A device bound to a VM on a specific node ties that VM to that node. Live migration is not possible for VMs with passthrough devices, because the target node would need an identical device with identical configuration. If node loss is a bigger business risk than slightly lower performance, you may choose virtual devices or SR IO V CNI plugins instead of PCI passthrough. For latency sensitive appliances, low level network appliances, or NVMe devices, that trade off often goes the other way.

An operational lesson from field reports is that pcidevice claims and actual physical devices can drift. In one issue, deleting a PCIDeviceClaim whose underlying device had already disappeared left the claim stuck, because the controller tried to reconcile against a missing PCIDevice. Designing operational runbooks that deallocate PCI devices cleanly before hardware changes reduces this kind of friction.

With correct firmware configuration, careful IOMMU grouping, and clear mapping of which VM uses which PCI devices, Harvester can run advanced workloads such as high performance NIC appliances, storage targets, and GPU hosts without sacrificing control or observability.

10.2: GPU And vGPU Configuration With Nvidia Tooling On Harvester

Section titled “10.2: GPU And vGPU Configuration With Nvidia Tooling On Harvester”

Modern GPU workloads are not a niche case anymore. AI model training, inference services, visualization and video processing often need hardware acceleration to be economically viable. Harvester has explicit support for NVIDIA GPUs, both as full passthrough devices and as virtual GPUs based on SR IO V capable cards. From Harvester v1.3 onward, there is a documented vGPU workflow that uses the pcidevices controller in combination with a NVIDIA driver toolkit daemonset and new CRDs for SR IO V GPU devices.

The base for any GPU work in Harvester is still PCI passthrough. You enable the pci devices controller addon, configure the host IOMMU, and expose GPUs as PCI devices that can be claimed. Guides that walk through enabling NVIDIA GPU support in Harvester consistently start with this step, because without the addon the cluster will not surface GPU devices in the UI at all.

Once you enable the addon, the controller scans hosts for PCI devices and creates PCIDevice objects. For simple passthrough, you enable the GPU device in the Harvester UI under Advanced, mark it for passthrough, and then attach it to one VM at a time. That model works well for workloads that need exclusive access to a card, such as dedicated training boxes or high end visualization stations.

The vGPU story starts when you have NVIDIA GPUs that support SR IO V based virtual functions. Harvester vGPU support is built around CRDs named sriovgpudevices.devices.harvesterhci.io and vgpudevices.devices.harvesterhci.io. The pcidevices controller scans hosts for NVIDIA GPUs that support SR IO V vGPU devices and creates SRIOVGPUDevice CRs for them. When you enable a particular SR IO V GPU in the UI, the controller works with the nvidia driver toolkit daemonset to configure profiles and populate VGPUDevice CRs.

These CRDs describe how many virtual GPUs exist on a host, which profiles are available, and which ones are allocated. The documentation notes that NVIDIA GPUs default to creating sixteen vGPU devices but that the number of usable vGPUs depends on the selected profile. Higher end profiles consume more resources per vGPU and therefore reduce the count of allocatable devices.

From an operator standpoint, the workflow has a clear set of steps. You confirm that the hardware supports SR IO V vGPU by checking vendor documentation. You enable the pcidevices controller addon and the NVIDIA driver toolkit. You go to the Harvester UI, verify that the GPU has been discovered as an SR IO V capable device, and enable it. You then configure vGPU profiles for that device and finally attach vGPUs to VMs. Rancher integration enhances this story by tracking allocatable vGPU devices across nodes and preventing overcommitment at the UI level, starting with newer Harvester and Rancher versions.

On the host side, the NVIDIA driver toolkit is delivered as a daemonset that runs on GPU nodes. It installs the correct NVIDIA drivers inside the SLE Micro host OS and configures the vGPU driver counterpart, often through packages or a proprietary installer. GPU provisioning examples for Harvester show this toolkit plus a Kubernetes device plugin for GPU scheduling.

A simple view of how the toolkit daemonset might look can help you reason about scheduling.

apiVersion: apps/v1
kind: DaemonSet
metadata:
name: nvidia-driver-toolkit
namespace: kube-system
spec:
selector:
matchLabels:
app: nvidia-driver-toolkit
template:
metadata:
labels:
app: nvidia-driver-toolkit
spec:
nodeSelector:
harvester.io/gpu-node: "true"
containers:
- name: toolkit
image: registry.example.com/nvidia/driver-toolkit:550.90.05
securityContext:
privileged: true
volumeMounts:
- name: host-root
mountPath: /host
volumes:
- name: host-root
hostPath:
path: /
type: Directory

In real environments you will use the official toolkit manifests from NVIDIA and SUSE rather than crafting your own, but the pattern is the same. Run a privileged daemonset on GPU nodes, mount the host filesystem, and let the container manage driver installation and configuration.

Inside a VM with a full GPU passthrough, GPU drivers and frameworks are installed as if you were on bare metal. Verification is straightforward.

Terminal window
# Inside a Linux VM with a passed through GPU
lspci | grep -i nvidia
nvidia-smi

For vGPU enabled VMs, you install NVIDIA guest drivers appropriate to the vGPU profile. Tools like nvidia-smi will show a vGPU type and the backing physical GPU. NVIDIA and Harvester documentation both stress matching driver versions between host and guest. Mismatches are a common source of errors where the guest fails to initialize the device.

Because vGPUs share a physical card, capacity planning becomes more subtle. You must decide whether a GPU will host a few large vGPUs for heavy workloads or many smaller vGPUs for lighter inference jobs. The profiles exposed by NVIDIA dictate what is possible, and Harvester surfaces those profiles for selection. Higher density deployments must monitor actual utilization, not just allocation, and may benefit from application side throttling to keep latency under control.

When GPUs and SR IO V NICs are both used, think about NUMA locality. Binding vGPUs and SR IO V NICs that live on the same socket to VMs whose vCPUs are pinned to that socket reduces cross socket traffic and improves latency. While Harvester abstracts away some of the raw host tuning, you can still use KubeVirt CPU pinning and topology hints to encourage good placement, especially for VMs that act as GPU accelerated network functions.

The net result is that Harvester can host a range of GPU driver workloads, from fully dedicated PCI GPU passthrough to finely sliced vGPUs for multi tenant environments, without requiring exotic hardware beyond what NVIDIA already supports for SR IO V and vGPU on KVM.

10.3: Performance Tuning For Storage, Databases And Latency Sensitive VMs

Section titled “10.3: Performance Tuning For Storage, Databases And Latency Sensitive VMs”

Harvester uses Longhorn for block storage, and Longhorn is a distributed system. That gives you node failure resilience and flexible scheduling but also adds network hops and software layers between the VM and the physical disk. Longhorn performance reports make this explicit by showing that in test setups, native disk IO latency might be on the order of 100 microseconds per operation while Longhorn adds another 400 to 500 microseconds depending on replica count and read or write direction.

This extra latency is acceptable for many workloads, but for storage heavy databases or tight latency budgets you need to tune carefully. There are three broad knobs you can turn at the storage layer: underlying hardware, Longhorn configuration, and workload behavior. Then you layer VM tuning on top of that.

On the hardware side, Longhorn documentation is clear. Use SSDs or NVMe disks, and if possible avoid mixing very slow and very fast disks in the same cluster. Guidance from Longhorn and Harvester knowledge base articles consistently points to using dedicated SATA or NVMe SSDs for Longhorn data and providing at least 10 Gbps network bandwidth between nodes for production.

Within Longhorn, replica count and data locality matter a lot. Higher replica counts increase durability but also amplify the amount of synchronous IO across the network. Data locality features try to keep a replica of a volume on the same node where it is attached, which reduces cross node traffic on the critical path. Longhorn provides a dataLocality setting per volume and per storage class. Setting it to best effort keeps data close when possible and falls back to remote replicas when node distribution demands it.

A storage class tuned for performance sensitive volumes might look like this.

apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: longhorn-perf
provisioner: driver.longhorn.io
parameters:
numberOfReplicas: "2"
staleReplicaTimeout: "30"
dataLocality: "best-effort"
unmapMarkSnapChainRemoved: "true"
reclaimPolicy: Delete
allowVolumeExpansion: true
volumeBindingMode: Immediate

Here, replica count is set to two rather than three, trading a bit of durability margin for less overhead and more available capacity. Data locality is enabled in best effort mode. The unmap parameter helps Longhorn reclaim space efficiently as snapshots are deleted. This kind of storage class is a good candidate for volumes hosting transactional databases or latency sensitive stateful services.

Longhorn v2 introduces a new data engine based on SPDK which significantly reduces IO latency and boosts IOPS by moving IO handling closer to the hardware and using user space networking. At the time of writing, the v2 data engine is marked as experimental and Longhorn and Harvester documentation explicitly say it should not be used in production yet. However, it is already valuable to evaluate it in lab environments to understand how much headroom it may give you in future versions.

Database workloads running on Harvester benefit from tuning inside the VM and at the Longhorn layer. At the VM level, allocate sufficient vCPUs and memory to avoid constant CPU starvation and swapping. For truly latency sensitive databases, consider using huge pages and CPU pinning in the VM spec to avoid cross core jitter and TLB churn. KubeVirt supports dedicated CPU placement and memory backing options that Harvester can surface.

A VM definition that uses dedicated CPU placement and huge pages might look as follows.

apiVersion: kubevirt.io/v1
kind: VirtualMachine
metadata:
name: db-latency-01
namespace: databases
labels:
workload: critical-db
spec:
running: true
template:
metadata:
labels:
kubevirt.io/domain: db-latency-01
workload: critical-db
spec:
domain:
cpu:
cores: 8
model: host-passthrough
dedicatedCpuPlacement: true
memory:
guest: 32Gi
hugepages:
pageSize: "2Mi"
devices:
disks:
- name: rootdisk
disk:
bus: virtio
- name: datadisk
disk:
bus: virtio
volumes:
- name: rootdisk
persistentVolumeClaim:
claimName: pvc-db-latency-01-root
- name: datadisk
persistentVolumeClaim:
claimName: pvc-db-latency-01-data

This configuration tries to reduce scheduler noise by dedicating host CPUs to the VM and uses huge pages for memory. On systems where NUMA is visible, you can also add topology hints or use node labels to constrain where this VM runs so that it stays on a node with suitable CPU and storage characteristics.

Workload behavior inside the guest matters as much as infrastructure tuning. Longhorn performance guidance often mentions tuning application and filesystem block sizes and queue depths. Running synthetic tests with fio inside the VM can help you find the sweet spot between maximizing throughput and keeping latency predictable.

Terminal window
fio --name=randread \
--filename=/var/lib/postgresql/data/testfile \
--direct=1 \
--rw=randread \
--bs=16k \
--iodepth=32 \
--numjobs=4 \
--runtime=60 \
--time_based \
--group_reporting

This command runs a random read benchmark against a file on the database volume with a block size and queue depth that resemble many OLTP workloads. You can adjust bs and iodepth to observe how latency and throughput change and then translate those observations into database settings such as max_parallel_workers_per_gather or InnoDB queue parameters.

Network layout can also undermine storage performance if it is not considered. Longhorn replicates data across nodes, so you want low latency and sufficient bandwidth between them. The Longhorn community warns against running Longhorn across distant sites with high RTT, because replication becomes painfully slow and the user interface itself can time out while trying to reach all nodes. In Harvester, stick to a single data center or very low latency campus environment for nodes that participate in a Longhorn cluster.

For ultra low latency VMs such as trading gateways or telecom soft switches, PCI passthrough of NICs combined with CPU pinning, aggressive offload settings and careful avoidance of noisy neighbors becomes necessary. These VMs might even use local disks or hostPath volumes pinned to specific nodes instead of Longhorn if the latency budget is severe and application level replication exists. In those cases, Harvester still gives you a central management plane, but you treat storage differently for that subset of workloads.

Finally, keep in mind that performance tuning is only useful if you can measure its effect. That leads directly to observability. Harvester and Longhorn both expose rich metrics that you should feed into a monitoring stack before you start chasing latency ghosts.

10.4: Observability With Metrics, Logs And Dashboards For Harvester And Longhorn

Section titled “10.4: Observability With Metrics, Logs And Dashboards For Harvester And Longhorn”

You cannot tune what you cannot see, and you cannot operate complex PCI, GPU and storage heavy workloads without a solid understanding of how the system behaves over time. Harvester includes a built in monitoring stack based on Prometheus and Grafana. During installation, monitoring is enabled automatically, and the Harvester dashboard shows cluster level metrics and a view of the top resource consuming VMs. From that dashboard, administrators can click through to Grafana dashboards for more detailed views. The documentation notes that only administrative users can see these cluster dashboards.

Under the hood, Harvester uses the same monitoring and alerting integration as Rancher. Prometheus scrapes metrics from Kubernetes components, Harvester system pods, Longhorn services and user workloads. Grafana presents the data via dashboards, and Alertmanager handles notifications based on Prometheus rules. Rancher documentation describes this model in detail and highlights that you can view metrics directly in the Rancher UI or switch to Grafana for complex queries.

Longhorn itself exposes dedicated metrics endpoints for both engine components and CSI sidecars. Longhorn documentation states that CSI sidecars are started with —http-endpoint flags so that Prometheus can scrape metrics such as operation counts, error counts and call latency. It lists standard ports, such as 8000, for these endpoints. There are also community and official Grafana dashboards for Longhorn that visualize volume throughput, latency, replica health and more.

In a Harvester environment, you typically want to integrate Longhorn metrics into the existing Prometheus stack rather than run a separate one. If you use Prometheus Operator or Rancher Monitoring, you can define a PodMonitor or ServiceMonitor for Longhorn components.

apiVersion: monitoring.coreos.com/v1
kind: PodMonitor
metadata:
name: longhorn-csi
namespace: cattle-monitoring-system
spec:
namespaceSelector:
matchNames:
- longhorn-system
selector:
matchLabels:
app: longhorn-csi-plugin
podMetricsEndpoints:
- port: metrics
path: /metrics
interval: 30s

This example tells Prometheus Operator to scrape pods labeled app=longhorn-csi-plugin in the longhorn-system namespace on a port named metrics. In practice you will adjust labels and ports to match the Longhorn deployment in your cluster. With this in place, Longhorn CSI metrics become part of your central metric store and can be visualized in Grafana.

You also want visibility into VM level performance. Harvester surfaces per VM metrics such as CPU usage, memory consumption and more in its UI. Prometheus can scrape node exporter metrics from SLE Micro hosts to show CPU steal time, IO wait and interrupt behavior, all of which are useful when diagnosing latency issues. For IO intensive VMs with PCI passthrough or SR IO V NICs, you can also monitor host level network stats to catch drops or queue buildup.

On the logging side, Harvester integrates with the usual Kubernetes logging patterns. You can deploy centralized logging stacks such as Loki, Elasticsearch or OpenSearch and ship container logs from Longhorn, KubeVirt and system services. When debugging PCI passthrough or GPU issues, virt launcher logs and pcidevices controller logs are particularly important. These logs will typically contain error messages about host device mapping problems, unsupported vGPU profiles or driver mismatches. Issues around generic host devices not matching expected device lists, as seen in bug reports, are only visible if you collect and search these logs systematically.

For comprehensive observability, combine metrics and logs into dashboards that describe specific questions. Examples include a Longhorn storage dashboard that shows per volume throughput, latency and replica health, a Harvester cluster dashboard with node status, VM counts and resource saturation, and a GPU dashboard that shows utilization and memory usage per GPU and per vGPU. The Grafana community dashboard for Longhorn is a good starting point for the storage view, and Rancher monitoring ships with cluster and node dashboards that you can adapt.

Alerting policies should align with your SLOs. For storage, you may alert when Longhorn replica counts drop below desired values, when rebuilding saturates network links, or when latency surpasses threshold values for sustained periods. For GPUs, you might alert when utilization stays pegged for too long or when vGPU allocation approaches the theoretical maximum on a host. For PCI passthrough networking, drop counters and error rates on host interfaces can feed alerts.

Because Harvester is a Kubernetes based platform, you can also use generic tools such as kube state metrics and node exporter to detect scheduling pressure, disk exhaustion and CPU contention. Combined with Longhorn and NVIDIA specific metrics, this gives you the full context you need to interpret application complaints correctly.

The last piece of the observability puzzle is tracing back configuration. Knowing that latency is high is useful, but you also need to know what changed. This is where the work you have already seen in the previous chapter around automation and GitOps pays off. When storage classes, VM specs, PCI device claims and Harvester settings all live in Git and are applied through pipelines, it becomes much easier to correlate a spike in latency or a rash of VM boot failures with a specifically merged change.

Bringing all of this together, advanced workloads on Harvester are not only about enabling PCI passthrough, SR IO V and GPU features. They depend on disciplined performance tuning at multiple layers and on observability that lets you see exactly how the cluster behaves over time. With proper PCI device management, well configured GPUs and vGPUs, tuned Longhorn storage and solid metrics and logs, Harvester can host some of the most demanding VM and Kubernetes workloads without you having to guess what is happening under the covers.