9.18. Advanced virtual machine management
9.18.1. Working with resource quotas for virtual machines 링크 복사링크가 클립보드에 복사되었습니다!
Manage and control virtual machine resource consumption to prevent overcommitment and ensure stable workload performance.
Create and manage resource quotas for virtual machines.
9.18.1.1. Setting resource quota limits for virtual machines by using the CLI 링크 복사링크가 클립보드에 복사되었습니다!
By default, OpenShift Virtualization automatically manages CPU and memory limits for virtual machines (VMs) if a namespace enforces resource quotas that require limits to be set. The memory limit is automatically set to twice the requested memory and the CPU limit is set to one per vCPU.
You can customize the memory limit ratio for a specific namespace by adding the alpha.kubevirt.io/auto-memory-limits-ratio label to the namespace. For example, the following command sets the memory limit ratio to 1.2:
$ oc label ns/my-virtualization-project alpha.kubevirt.io/auto-memory-limits-ratio=1.2
Avoid managing resource quota limits manually. To prevent misconfigurations or scheduling issues, rely on the automatic resource limit management provided by OpenShift Virtualization unless you have a specific need to override the defaults.
Resource quotas that only use requests automatically work with VMs. If your resource quota uses limits, you must manually set resource limits on VMs. Memory resource limits, defined by the spec.template.spec.domain.resources.limits.memory value, must be at least 500 MiB, or 2% larger than the spec.template.spec.domain.memory.guest value.
Procedure
Set limits for a VM by editing the
VirtualMachinemanifest. For example:apiVersion: kubevirt.io/v1 kind: VirtualMachine metadata: name: with-limits spec: runStrategy: Halted template: spec: domain: memory: guest: 128Mi resources: limits: memory: 256Miwhere
- spec.template.spec.domain.memory.guest
- Specifies the actual amount of RAM that is shown to the guest operating system in the VM.
- spec.template.spec.domain.resources.limits.memory
Specifies the hard limit for total memory consumption by the
virt-launcherpod that hosts the VM. This limit must account for the guest operating system RAM plus the hypervisor runtime resource consumption.This example configuration is supported because the
spec.template.spec.domain.resources.limits.memoryvalue is at least100Milarger than thespec.template.spec.domain.memory.guestvalue.
-
Save the
VirtualMachinemanifest.
9.18.1.2. Understanding the Application Aware Quota Operator 링크 복사링크가 클립보드에 복사되었습니다!
The Application Aware Quota (AAQ) operator extends Kubernetes native ResourceQuota to measure virtual machine (VM) resource consumption in mixed pod and VM environments.
AAQ provides quota enforcement designed for virtualization workloads:
- Kubernetes ResourceQuota
- Measures and enforces resource limits at the pod level. When applied to VMs, it measures the entire VM pod’s resource consumption, including hypervisor overhead and pod infrastructure, which does not reflect actual VM resource allocation.
- Application Aware Quota (AAQ)
- Extends ResourceQuota functionality to accurately measure and enforce VM resource consumption. AAQ understands the virtualization layer and can measure actual virtual CPU and memory allocated to VMs, separate from pod overhead.
AAQ supports two types of quotas:
- Project-scoped quotas
- Apply resource limits to a specific namespace or project. These are the most common use case for virtualization workloads.
- Cluster-scoped quotas
- Apply resource limits across the entire cluster. These are useful for advanced scenarios where you need cluster-wide resource enforcement.
When you enable AAQ, you must configure a quota calculation method. This setting determines how AAQ measures VM resource consumption across your cluster:
- Virtual resources
- Measures only the virtual CPU and memory allocated to virtual machines (VMs), excluding pod runtime overhead. This is the default option for virtualization workloads.
- Virtual Machine Instance (VMI) pod usage
- Measures the total virtual CPU and memory consumption of the VM pod, including both the virtual machine and pod runtime overhead.
- Dedicated virtual resources
- Measures the virtual CPU and memory resources assigned to virtual machines and their associated pods, tracking quota usage separately for each type.
9.18.1.3. Enabling the Application Aware Quota Operator 링크 복사링크가 클립보드에 복사되었습니다!
Enable the Application Aware Quota (AAQ) operator to manage resource quotas to extend native resource management capabilities. Enabling AAQ from the web console eliminates the need to manually edit the HyperConverged custom resource by using the CLI.
Prerequisites
- You have cluster administrator privileges.
- The OpenShift Virtualization operator is installed and running.
Procedure
-
In the OpenShift Container Platform web console, click Virtualization
Settings. Under Resource Management, toggle the Application Aware Quotas (AAQ) to On.
The operator deployment begins automatically. The status changes from Disabled to Enabled after the operator pods are running.
Optional: Click the Edit icon next to the Quota calculation method field to change the calculation method.
A modal dialog is displayed with the following options:
- Virtual resources: Measures only the virtual CPU and memory allocated to virtual machines (VMs), excluding pod runtime overhead. This is the default option for virtualization workloads.
- Virtual Machine Instance (VMI) pod usage: Measures the total virtual CPU and memory consumption of the VM pod, including both the virtual machine and pod runtime overhead.
- Dedicated virtual resources: Measures the virtual CPU and memory resources assigned to virtual machines and their associated pods, tracking quota usage separately for each type.
- Select your preferred quota calculation method and click Save.
Verification
- Verify that a new Quotas option is displayed in the left navigation menu under Virtualization. This indicates that AAQ is ready for quota creation and management.
9.18.1.4. Creating virtual machine quotas using the web console 링크 복사링크가 클립보드에 복사되었습니다!
You can create Application Aware Quota (AAQ) quotas that limit virtual machine resource consumption by using the guided form in the OpenShift Container Platform web console. The form is the recommended approach for simple virtualization quota use cases.
Prerequisites
- You have cluster administrator privileges.
- The Application Aware Quota operator is enabled in your cluster. See Enabling the Application Aware Quota operator.
- The project where you want to create the quota exists.
Procedure
-
In the OpenShift Container Platform web console, click Virtualization
Quotas. - Click Create quota.
In the dropdown menu, select With form.
The create quota form is displayed.
Enter a name for your quota in the Name field.
The name must be unique within the project.
Select the project where you want to apply this quota.
By default, the current project is selected. You can click the dropdown to select a different project if needed.
참고If a Kubernetes
ResourceQuotaalready exists in the selected project, an alert is displayed with a link to view the existing ResourceQuota. You can still create the AAQ quota, but both quotas will apply to the project.Configure CPU, memory, and VMI limits for the quota:
The fields displayed vary based on the selected quota calculation method. For example:
For the
Virtual resourcesorDedicated virtual resourcesquota calculation method, the quotas exclude pod overhead:- Use the vCPU allocation field to set the maximum number of virtual CPUs permitted for all VMs in the project, excluding infrastructure overhead.
- Use the Virtual memory allocation field to set the maximum memory capacity, in GiB, excluding infrastructure overhead.
- Use the VMI limits field to set the maximum number of virtual machine instances.
For the
Virtual Machine Instance (VMI) pod usagequota calculation method, the quotas include pod overhead:- Use the CPU allocation field to set the maximum number of CPU cores for pods that run VM workloads
- Use the Memory allocation field to set the maximum memory capacity, in GiB, for pods that run VM workloads.
Use the VMI limits field to set the maximum number of virtual machine instances.
참고Live migration overhead is excluded from the
Virtual Machine Instance (VMI) pod usagequota calculation method.
Review the configuration and click Create.
The quota is created and you are redirected to the quota details page. The new quota is now active and enforcing resource limits on virtual machines in the selected project.
Verification
-
In the OpenShift Container Platform web console, click Virtualization
Quotas. - In the quotas list, locate your newly created quota.
- Verify that the quota name is displayed in the list with the correct project and resource limits configured.
- Click the quota name to open its details page and confirm all settings are correct.
9.18.1.5. Managing virtual machine quotas using the list view 링크 복사링크가 클립보드에 복사되었습니다!
The Application Aware Quota (AAQ) quotas page in the OpenShift Container Platform web console provides a centralized view of all quotas managed by the AAQ operator. From this page, you can view quota status, usage, and perform management actions such as editing and deleting quotas.
Prerequisites
- You have cluster administrator privileges.
- The Application Aware Quota operator is enabled in your cluster.
- At least one Application Aware Quota exists in a namespace that matches the label selector configured in the HyperConverged Operator (HCO).
Procedure
In the OpenShift Container Platform web console, click Virtualization
Quotas. The quotas list view is displayed, showing all project-scoped AAQ quotas by default.
Click the Cluster-scoped quotas tab to view cluster scoped quotas.
This tab is displayed only if cluster-scoped quotas have been defined in your cluster.
참고Cluster-scoped quotas can only be created or edited using YAML. The form-based creation option is not available for cluster-scoped quotas due to their complexity.
- To view detailed information about a specific quota, click the quota name to open the quota details page.
To edit a quota, click the Options menu
at the end of the quota row
Select Edit quota.
The edit form is displayed with the current quota configuration.
Click Save after you have completed modifying the resource limits.
참고If the quota was initially created with advanced settings via YAML, clicking Edit quota opens the YAML editor instead of the form.
To delete a quota, click the Options menu
at the end of the quota row and select Delete quota. A confirmation dialog is displayed.
Click Delete to remove the quota.
주의Deleting a quota removes all resource enforcement for the quota. Virtual machines in the affected project are no longer subject to the quota limits.
To create a new quota from the list view, click Create quota.
Select an option from the dropdown menu:
- With form: Opens the form-based creation experience for simple VM quota use cases.
- With YAML: Opens the YAML editor for advanced quota configurations that include pod limits or other resource types.
9.18.1.6. Managing virtual machine quota details using the web console 링크 복사링크가 클립보드에 복사되었습니다!
The quota details page in the OpenShift Container Platform web console provides information about an Application Aware Quota (AAQ), including resource limits, current usage, and visualizations of how quota capacity is being consumed.
Cluster scoped quotas show only the YAML definition due to the complexity that these quotas require.
Prerequisites
- You have cluster administrator privileges.
- The Application Aware Quota operator is enabled in your cluster.
- An Application Aware Quota exists in your cluster.
Procedure
-
In the OpenShift Container Platform web console, click Virtualization
Quotas. Click the quota name to open the Quota details view.
The Quota details view displays visual indicators, quota metadata, and tabulated data:
- Circular utilization charts visually represent resource consumption in your project
- The Details element provides metadata such as the Quota name, scope, applied labels and project.
The Quota details element provides a tabulated views that display the current and maximum utilization of each resource type.
참고If a Kubernetes
ResourceQuotaalso exists in the same project as this AAQ quota, an alert is displayed at the top of the details page with a link to view the ResourceQuota. Both quotas apply simultaneously to the project.
- Optional: Click the YAML tab to review the resource configuration of the quota.
- Optional: Use the Actions panel to edit or delete the quota.