Skip to main content

Overview

The KubeVirt class represents the primary resource for deploying and configuring the KubeVirt virtualization platform in an OpenShift cluster. It manages all KubeVirt infrastructure components and provides cluster-wide virtualization configuration.

Class Definition

Constructor

dict
Configuration for certificate rotation strategy.
dict
KubeVirt configuration settings, equivalent to the virt-config ConfigMap.
dict
Customization options for KubeVirt components.
string
Image pull policy for KubeVirt containers: "Always", "IfNotPresent", or "Never".
list
List of image pull secrets for accessing private container registries.
string
Container image registry to pull KubeVirt images from. Defaults to the operator’s registry.
string
Tag for KubeVirt container images. Defaults to the operator’s image tag.
dict
Node selectors and tolerations for KubeVirt infrastructure components.
string
Prometheus service account name for monitoring KubeVirt endpoints. Defaults to "prometheus-k8s".
string
Namespace where Prometheus is deployed. Defaults to "openshift-monitor".
string
Value for the apps.kubevirt.io/component label. Defaults to "kubevirt" if not specified.
string
Value for the apps.kubevirt.io/part-of label. Useful when KubeVirt is part of a larger product.
string
Value for the apps.kubevirt.io/version label. Defaults to KubeVirt’s version if not specified.
string
Namespace for deploying ServiceMonitor objects. If not set, uses monitor_namespace.
string
Controls whether KubeVirt can be deleted when workloads are present. Prevents accidental data loss.
dict
Cluster-wide strategy for handling automated workload updates.
dict
Node selectors and tolerations that apply to KubeVirt workload pods (VMs).

Usage Examples

Configuration Options

Feature Gates

Common feature gates that can be enabled in the configuration parameter:
  • LiveMigration: Enable live migration of VMs between nodes
  • HotplugVolumes: Allow hotplugging of volumes to running VMs
  • CPUManager: Enable CPU manager integration
  • GPU: Enable GPU passthrough support
  • HostDevices: Enable host device passthrough
  • Snapshot: Enable VM snapshot support
  • HotplugNICs: Allow hotplugging of network interfaces

Network Configuration

Network-related configuration options:

Developer Configuration

Developer and debugging options:

Status Conditions

The KubeVirt resource reports the following conditions:
  • Available: All KubeVirt components are ready
  • Progressing: KubeVirt is being deployed or updated
  • Degraded: One or more components are not functioning properly

VirtualMachine

Create and manage virtual machines

DataVolume

Manage persistent storage for VMs

Notes

The KubeVirt resource is typically deployed by the OpenShift Virtualization operator. Manual creation is only needed for custom deployments or advanced configurations.
Changing certain configuration options (like image_registry or image_tag) may trigger a rolling update of all KubeVirt components and could cause brief service interruptions.
Use the uninstall_strategy parameter set to "BlockUninstallIfWorkloadsExist" to prevent accidental deletion of KubeVirt when VMs are still running.