×

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.11 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.

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.11.8
      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 <file name>.yaml

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.11.8   OKD Virtualization   4.11.8                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.