×

Install OKD Virtualization to add virtualization functionality to your OKD cluster. You can subscribe to and deploy the OKD Virtualization Operators by using the command line to apply manifests to your cluster.

To specify the nodes where you want OKD Virtualization to install its components, configure node placement rules.

Prerequisites

  • Install OKD 4.12 on your cluster.

  • Install the OpenShift CLI (oc).

  • Log in as a user with cluster-admin privileges.

Subscribing to the OKD Virtualization catalog by using the CLI

Before you install OKD Virtualization, you must subscribe to the OKD Virtualization catalog. Subscribing gives the openshift-cnv namespace access to the OKD Virtualization Operators.

To subscribe, configure Namespace, OperatorGroup, and Subscription objects by applying a single manifest to your cluster.

Prerequisites
  • Install OKD 4.12 on your cluster.

  • Install the OpenShift CLI (oc).

  • Log in as a user with cluster-admin privileges.

Procedure
  1. Create a YAML file that contains the following manifest:

    apiVersion: v1
    kind: Namespace
    metadata:
      name: openshift-cnv
    ---
    apiVersion: operators.coreos.com/v1
    kind: OperatorGroup
    metadata:
      name: kubevirt-hyperconverged-group
      namespace: openshift-cnv
    spec:
      targetNamespaces:
        - openshift-cnv
    ---
    apiVersion: operators.coreos.com/v1alpha1
    kind: Subscription
    metadata:
      name: hco-operatorhub
      namespace: openshift-cnv
    spec:
      source: redhat-operators
      sourceNamespace: openshift-marketplace
      name: kubevirt-hyperconverged
      startingCSV: kubevirt-hyperconverged-operator.v4.12.20
      channel: "stable" (1)
    1 Using the stable channel ensures that you install the version of OKD Virtualization that is compatible with your OKD version.
  2. Create the required Namespace, OperatorGroup, and Subscription objects for OKD Virtualization by running the following command:

    $ oc apply -f <filename>.yaml
Verification

You must verify that the subscription creation was successful before you can proceed with installing OKD Virtualization.

  1. Check that the ClusterServiceVersion (CSV) object was created successfully. Run the following command and verify the output:

    $ oc get csv -n {CNVNamespace}

    If the CSV was created successfully, the output shows an entry that contains a NAME value of kubevirt-hyperconverged-operator-*, a DISPLAY value of OKD Virtualization, and a PHASE value of Succeeded, as shown in the following example output:

    Example output

    NAME                                       DISPLAY                    VERSION   REPLACES                                   PHASE
    kubevirt-hyperconverged-operator.v4.12.20   OKD Virtualization   4.12.20    kubevirt-hyperconverged-operator.v4.11.0   Succeeded
  2. Check that the HyperConverged custom resource (CR) has the correct version. Run the following command and verify the output:

    $ oc get hco -n {CNVNamespace} kubevirt-hyperconverged -o json | jq .status.versions

    Example output

    {
    "name": "operator",
    "version": "4.12.20"
    }
  3. Verify the HyperConverged CR conditions. Run the following command and check the output:

    $ oc get hco kubevirt-hyperconverged -n {CNVNamespace} -o json | jq -r '.status.conditions[] | {type,status}'

    Example output

    {
      "type": "ReconcileComplete",
      "status": "True"
    }
    {
      "type": "Available",
      "status": "True"
    }
    {
      "type": "Progressing",
      "status": "False"
    }
    {
      "type": "Degraded",
      "status": "False"
    }
    {
      "type": "Upgradeable",
      "status": "True"
    }

You can configure certificate rotation parameters in the YAML file.

Deploying the OKD Virtualization Operator by using the CLI

You can deploy the OKD Virtualization Operator by using the oc CLI.

Prerequisites
  • An active subscription to the OKD Virtualization catalog in the openshift-cnv namespace.

Procedure
  1. Create a YAML file that contains the following manifest:

    apiVersion: hco.kubevirt.io/v1beta1
    kind: HyperConverged
    metadata:
      name: kubevirt-hyperconverged
      namespace: openshift-cnv
    spec:
  2. Deploy the OKD Virtualization Operator by running the following command:

    $ oc apply -f <file_name>.yaml
Verification
  • Ensure that OKD Virtualization deployed successfully by watching the PHASE of the cluster service version (CSV) in the openshift-cnv namespace. Run the following command:

    $ watch oc get csv -n openshift-cnv

    The following output displays if deployment was successful:

    Example output
    NAME                                      DISPLAY                    VERSION   REPLACES   PHASE
    kubevirt-hyperconverged-operator.v4.12.20   OKD Virtualization   4.12.20                Succeeded

Next steps

You might want to additionally configure the following components:

  • The hostpath provisioner is a local storage provisioner designed for OKD Virtualization. If you want to configure local storage for virtual machines, you must enable the hostpath provisioner first.