Dieser Inhalt ist in der von Ihnen ausgewählten Sprache nicht verfügbar.
Virtualization
Learn how to manage {rhocpv-short} virtual machine resources across clusters that Red Hat Advanced Cluster Management manages.
Abstract
Chapter 1. Virtualization Link kopierenLink in die Zwischenablage kopiert!
Manage {rhocpv-short} virtual machine resources across all the clusters that Red Hat Advanced Cluster Management manages.
1.1. Enabling virtual machine actions (Technology Preview) Link kopierenLink in die Zwischenablage kopiert!
To view VirtualMachine resources across all the clusters that Red Hat Advanced Cluster Management for Kubernetes manages, use the Search service to list and filter the VirtualMachine resources created with the Red Hat OpenShift Virtualization. You can also enable the following actions from the Red Hat Advanced Cluster Management console on your VirtualMachine resources:
- Start
- Stop
- Restart
- Pause
- Unpause
Required access: Cluster administrator
1.1.1. Prerequisites Link kopierenLink in die Zwischenablage kopiert!
Confirm that the ManagedServiceAccount add-on is enabled. See ManagedServiceAccount add-on.
1.1.2. Enabling virtual machine actions for Red Hat Advanced Cluster Management Link kopierenLink in die Zwischenablage kopiert!
You can enable the virtual machine actions for Red Hat Advanced Cluster Management by adding the virtual-machine-preview=true annotation to the search operator. Run the following command to add the annotation:
oc annotate search search-v2-operator -n open-cluster-management virtual-machine-preview='true'
oc annotate search search-v2-operator -n open-cluster-management virtual-machine-preview='true'
You can verify that virtual machine actions for Red Hat Advanced Cluster Management are enabled by checking the search operator status:
1.1.3. Disabling virtual machine actions Link kopierenLink in die Zwischenablage kopiert!
To disable virtual machine actions for Red Hat Advanced Cluster Management, remove the virtual-machine-preview annotation by running the following command:
oc annotate search search-v2-operator -n open-cluster-management virtual-machine-preview-
oc annotate search search-v2-operator -n open-cluster-management virtual-machine-preview-
The virtual machine actions are disabled for Red Hat Advanced Cluster Management.
1.2. Viewing virtual machine metrics through Observability fields Link kopierenLink in die Zwischenablage kopiert!
If you have the Observability service installed on your hub cluster, you can access the Observability fields on the Red Hat Advanced Cluster Management console to view your virtual machine metrics.
Access the Observability fields by completing the following steps:
-
On the Red Hat Advanced Cluster Management console, go to the
Virtual Machinepage. Select the
Observability dashboardslink to launch theGrafanadashboard.-
Optional: Select the
Observability metricslink in theLaunch linkstable cell to launch theGrafanadashboard,
-
Optional: Select the
-
From the
Grafanadashboard, view the virtual machines and their individual metrics.
1.3. Configuring backup and restore for Red Hat OpenShift Virtualization using Red Hat Advanced Cluster Management policies Link kopierenLink in die Zwischenablage kopiert!
Use the Red Hat Advanced Cluster Management backup and restore component to install Red Hat Advanced Cluster Management policies that can be used to backup and restore the OpenShift Virtualization resources. With these policies, you can backup and restore virtual machines by using OpenShift APIS for Data Protection (OADP). After you back up the virtual machines, you can run and restore it on the hub cluster or managed clusters.
These Red Hat Advanced Cluster Management policies for OpenShift Virtualization support the following backup and restore storage options:
- Container Storage Interface (CSI) backups
- Container Storage Interface (CSI) backups with DataMover
They do not support the following options:
- File system backup and restore
- Volume snapshot backups and restores
To configure the policies, and either enable a backup schedule or run a restore operation for a virtual machine, complete the following sections:
1.3.1. Backing up and restoring a virtual machine Link kopierenLink in die Zwischenablage kopiert!
You can back up virtual machines that run on a cluster or restore a virtual machine on a cluster by completing the following steps:
-
Enable the backup component on the hub cluster by setting the
cluster-backupparameter inMultiClusterHubtotrue. To place the policies on the
cluster-namecluster, add theacm-virt-configlabel to theManagedClusterresource by using the following YAML sample:Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- The
acm-dr-virt-configthat passes through the label annotation, is aacm-virt-configConfigMap. Read theacm-dr-virt-configConfigMapsection to understand how to configure OADP and backup storage location.
Complete the following steps, depending on whether you want to backup or restore your virtual machine:
-
Back up your virtual machine by adding the
cluster.open-cluster-management.io/backup-vmto thekubevirt.io.VirtualMachineresource. Yourkubevirt.io.VirtualMachineresource might resemble the following YAML sample:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
Restore your virtual machine by updating the
acm-dr-restore-configConfigMapas described in theacm-dr-virt-restore-configsection.
-
Back up your virtual machine by adding the
1.3.2. Virtualization policies installed on the hub cluster Link kopierenLink in die Zwischenablage kopiert!
When you enable the backup operator, a set of Red Hat Advanced Cluster Management policies and ConfigMaps, get installed on the hub cluster. When you disable the policy or remove it from the cluster, all the resources the policy created gets removed. To learn more about the different types of policies available to you, complete the following sections:
1.3.2.1. Installation policy Link kopierenLink in die Zwischenablage kopiert!
The acm-dr-virt-install installation policy installs OADP and configures the oadp.openshift.io.DataProtectionApplication resource on the cluster where this policy is placed. If the cluster is a hub cluster, it verifies that OADP is installed in the open-cluster-management-backup namespace and that the DataProtectionApplication resource exists and has the required configuration. The policy does not attempt to install OADP or create the DataProtectionApplication resource on the hub cluster.
When you enable the cluster-backup option on the MultiClusterHub resource, the backup chart installs the OADP. When you enable the cluster-backup-option, you create the DataProtectionApplication on the hub cluster.
See the following installation policy templates and descriptions:
- Installation policy templates
| Template | Description |
|
|
Verifies that the |
|
| Verifies if there is an OADP version installed on the cluster, and that it matches the version installed by the policy. |
|
|
Verifies that the |
|
|
Creates the namespace where OADP gets installed, if this namespace is not found. Copies the OADP secret and installs OADP, but only for managed clusters. Creates the |
1.3.2.2. Backup policy Link kopierenLink in die Zwischenablage kopiert!
The acm-dr-virt-backup backup policy backs up the kubevirt.io.VirtualMachine resources that has the label, cluster.open-cluster-management.io/backup-vm: schedule_cron_name.
See the following backup policy templates and descriptions:
- Backup policy templates
| Template | Description |
|
|
Shows a violation error if there is any cron schedule name used by a virtual machine |
|
|
If the schedule is not paused, it verifies that the status is |
|
|
Creates velero schedules for all virtual machine resources with a |
1.3.2.3. Restore policy Link kopierenLink in die Zwischenablage kopiert!
The acm-dr-virt-restore restore policy restores the kubevirt.io.VirtualMachine resources by UID. The policy creates velero restore resources on clusters using the information from the ConfigMap identified by the restore_hub_config_name property from the acm-dr-virt-config ConfigMap.
See the following restore policy templates and descriptions:
- Restore policy templates
| Template | Description |
|
|
Verifies that the restore resource with the name defined by the |
|
|
If the |
1.3.3. Defining policies with ConfigMaps Link kopierenLink in die Zwischenablage kopiert!
When you install the policies on the hub cluster, the following ConfigMaps are created on the hub cluster, in the open-cluster-management-backup namespace. When you place the virtualization policies on the hub or managed cluster, these ConfigMaps define the backup and restore configuration for the virtualization policies.
1.3.3.1. Defining the acm-dr-virt-config ConfigMap Link kopierenLink in die Zwischenablage kopiert!
The acm-dr-virt-config ConfigMap defines the OADP configuration and other settings related to the backup or restore operation. You can use the name of this resource as the value for the acm-virt-config label which is set on the ManagedCluter where the policies are placed. You can also create a new ConfigMap that uses the acm-dr-virt-config as a sample, then use this new ConfigMap to place the virtualization policies on the cluster.
To place the virtualization policies on a managed cluster or hub cluster, complete the following steps:
Use the
acm-dr-virt-configor create a newConfigMapon the hub cluster in theopen-cluster-management-backupnamespace, by using theacm-dr-virt-configConfigMapas an example. For this example, the name isConfigMapacm-dr-virt-config-new.-
Update the
dpa_specsection to match the storage location where you want to store the backups created by OADP. This is a required update. -
Optional: Update other properties available with the
acm-dr-virt-config-newConfigMap, such as OADP version or channel.
-
Update the
-
Add the
acm-virt-config=acm-dr-virt-config-newlabel to the ManagedCluster resource. The value of theacm-virt-configlabel is the name of theConfigMapthat you created.
For an example of a ManagedCluster resource with a virtualization backup label set to use the acm-dr-virt-config-new ConfigMap, see the following YAML sample:
To learn more, see the following tables:
-
ConfigMapproperties for theacm-dr-virt-installpolicy
| Name | Description | Type | Default value | Optional |
|
| The channel defaults to the supported OADP version, which is based on the version of the OpenShift Container Platform cluster. Use this property to overwrite the default value. | String | None | Yes |
|
|
OADP channel name. Set this property for custom installation, for example: | String |
| Yes |
|
|
OADP subscription. Set this property for custom installation, for example: | String |
| Yes |
|
|
OADP subscription source. Set this property for custom installation, for example: | String |
| Yes |
|
| OADP subscription startingCSV. | String | None | Yes |
|
| OADP install plan. | String | Automatic | Yes |
|
| Namespace where OADP gets installed on the managed cluster. | String | None | No |
|
|
Name of the OADP secret to be used on the managed cluster. A Secret with this name must exist on the hub cluster in the | String | None | No |
|
|
Name of the secret used by the OADP | JSON | None | No |
|
|
Name of the | String | None | No |
|
|
Valid JSON defining the | JSON | None | No |
-
ConfigMapproperties for theacm-dr-virt-backuppolicy
| Name | Description | Type | Default value | Optional |
|
| Backup expiration time. | String |
| Yes |
|
|
Set to | String | False | Yes |
|
|
Name of the | String | None | Yes |
-
ConfigMapproperties for theacm-dr-virt-restorepolicy
| Name | Description | Type | Default value | Optional |
|
|
Name of the | String | None | No |
1.3.3.2. Defining the acm-dr-virt-schedule-cron ConfigMap Link kopierenLink in die Zwischenablage kopiert!
Use the acm-dr-virt-schedule-cron ConfigMap to define the valid cron job schedules to be used when scheduling a virtual machine backup. The acm-dr-virt-schedule-cron ConfigMap is created by the hub cluster backup component in the open-cluster-management-backup namespace and includes the following YAML:
You can use any of the schedules by the acm-dr-virt-schedule-cron ConfigMap to set the backup schedule for a kubevirt.io.VirtualMachine. For example, if you want to backup a virtual machine every day at 8am, add the following label to the virtual machine resource:
Since this acm-dr-virt-schedule-cron ConfigMap was created and is managed by the hub cluster backup component, you cannot change any of the existing cron properties or delete them. The properties are recreated when the content is reconciled. You can only add new properties to the existing ones. For example, if you want to create a cron job to run every Saturday, add the following label to the existing acm-dr-virt-schedule-cron properties: every_sunday: "0 0 * * SAT".
1.3.3.3. Defining the acm-dr-virt-restore-config ConfigMap Link kopierenLink in die Zwischenablage kopiert!
Use the acm-dr-virt-restore-config ConfigMap to define the restore operations to be implmented by the acm-dr-virt-restore policy. The ConfigMap is created by the hub backup component in the open-cluster-management-backup namespace.
For an example of a complete restore operation, see the following YAML sample:
- 1
2a054d24-3235-4249-9c81-f58ebc6110c7is the clusterId where the restore must be completed.acm-rho-virt-schedule-every-10-hours-20250120230438is the name of the backup to be used for the restore operation.- 2
restore-20250120230438is the name of the restore resource created as a result of this restore operation.- 3
2a054d24-3235-4249-9c81-f58ebc6110c7is the UID of the VM backed up with the acm-rho-virt-schedule-every-10-hours-20250120230438 backup to be restored.
1.3.4. Creating restore operations with restore policies Link kopierenLink in die Zwischenablage kopiert!
When you install virtualization policies for your restore operations, consider the following scenarios:
-
If you set the
clusterID_restoreNameproperty from theacm-dr-virt-restore-configConfigMapto an empty value, then the restore resource created by theacm-dr-virt-restorepolicy on the cluster withclusterIDgets deleted. -
If you set the
clusterID_restoreNameproperty from theacm-dr-virt-restore-configConfigMapto a non-empty value, then theacm-dr-virt-restorepolicy creates a velero Restore resource . This velero restore resource has a name that matches theclusterID_restoreNamevalue. If the restore resource with this name is deleted from the restore cluster, theacm-dr-virt-restorepolicy recreates the resource which results in the restore operation running again. Consider the following actions:
- Do not delete the restore resource if you do not want to run the restore again.
-
Set the
clusterID_restoreNameto empty on theacm-dr-virt-restore-configConfigMap as soon as the restore operation gets verified to be completed successfully. Doing this prevents you from having to rerun the restore operation if theacm-dr-virt-restorepolicy is disabled and enabled again. When theacm-dr-virt-restorepolicy is disabled, all resources created by it on the restore cluster get cleaned up and recreated when the policy is enabled again.