Home / Platform management / Virtualization / Prepare a virtualized environment

Prepare a virtualized environment

To enable project personnel to fully use virtualization features in the container platform, platform administrators need to perform the following operations to prepare the virtualization environment.

Prerequisites

When using virtualization features, it is necessary to plan and prepare the network and storage environment in advance.

Caution:

Turn on node virtualization

When the nodes of the self-built cluster are Physical Machines, you can control whether Kubernetes allows virtual machines (VMI, VirtualMachineInstance) to be scheduled to the node by turning on the node virtualization switch.

Procedure

  1. In the left navigation bar, click Clusters > Clusters.

  2. Click Self-hosted Cluster Name.

  3. On the Node tab, click the > Enable Virtualization on the right side of the node where the virtualization switch is to be set.

  4. Click Confirm.

Deploy kubevirt Operator

Refer to the Installation Operator document to install the KubeVirt HyperConverged Cluster Operator.

Caution: In the Install model parameter, you must select Namespace scoped and deploy it under the kubevirt namespace.

Create a hyperconverged instance

  1. In the left navigation bar, click Catalog > Operators.

  2. On the Deployed Operators tab, click kubevirt-operator.

  3. Click Create Instance on the HyperConverged instance card.

    Note: Only one HyperConverged instance needs to be created per cluster.

  4. Switch to the YAML view and configure the Virtual Machine Image Repository Address according to the following example.

    apiVersion: hco.kubevirt.io/v1beta1
    kind: HyperConverged
    metadata:
      name: kubevirt-hyperconverged
      namespace: kubevirt
    spec:
      storageImport:
        insecureRegistries:
        - "192.168.16.214:60080" # Virtual Machine Image Repository Address

    Note: Other parameters (such as name) can use default values.

  5. Wait for the CDI and KubeVirt types of instances to be automatically created in the resource list, and the status.phase displayed in the YAML is in the deployed state, indicating that the HyperConverged instance has been successfully created.

Configure virtual machine overcommit (Optional)

If you need to configure the oversubscription ratio for virtual machines, please enter the deployed KubeVirt Operator for separate configuration.

Cautions

Procedure

  1. In the left navigation bar, click Catalog > Operators.

  2. On the Deployed Operators tab, click kubevirt-operator.

  3. Click the Resource Instances tab, update the kubevirt-hyperconverged resource instance, switch to the YAML view, and add the following field in the annotation section:

    kubevirt.kubevirt.io/jsonpatch: |-
      [
        {
          "op": "add",
          "path": "/spec/configuration/developerConfiguration",
          "value": {"cpuAllocationRatio": 4}  # In this example CPU Overselling Ratio Configuration is 4 
        }
      ]
  4. Click Update.

Resource quota description

The memory resource quota of a virtual machine is limited by the memory resource quota of the namespace it belongs to. As the memory of the Pod that hosts the virtual machine is usually larger than the actual available memory of the virtual machine, it is recommended to reserve 20% of the resources. When the remaining available resources in the namespace are less than 20%, please expand in a timely manner.