×

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.13 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 kubevirt-hyperconverged 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: kubevirt-hyperconverged
    ---
    apiVersion: operators.coreos.com/v1
    kind: OperatorGroup
    metadata:
      name: kubevirt-hyperconverged-group
      namespace: kubevirt-hyperconverged
    spec: {}
    ---
    apiVersion: operators.coreos.com/v1alpha1
    kind: Subscription
    metadata:
      name: hco-operatorhub
      namespace: kubevirt-hyperconverged
    spec:
      source: community-operators
      sourceNamespace: openshift-marketplace
      name: community-kubevirt-hyperconverged
      startingCSV: kubevirt-hyperconverged-operator.v4.13.11
      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 kubevirt-hyperconverged namespace.

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

    apiVersion: hco.kubevirt.io/v1beta1
    kind: HyperConverged
    metadata:
      name: kubevirt-hyperconverged
      namespace: kubevirt-hyperconverged
    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 kubevirt-hyperconverged namespace. Run the following command:

    $ watch oc get csv -n kubevirt-hyperconverged

    The following output displays if deployment was successful:

    Example output
    NAME                                      DISPLAY                    VERSION   REPLACES   PHASE
    kubevirt-hyperconverged-operator.v4.13.11   OKD Virtualization   4.13.11                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.