Chapter 1. Container-native virtualization installation


1.1. About container-native virtualization

Learn about container-native virtualization’s capabilities and support scope.

1.1.1. What you can do with container-native virtualization

Container-native virtualization is an add-on to OpenShift Container Platform that allows you to run and manage virtual machine workloads alongside container workloads.

Container-native virtualization adds new objects into your OpenShift Container Platform cluster via Kubernetes custom resources to enable virtualization tasks. These tasks include:

  • Creating and managing Linux and Windows virtual machines
  • Connecting to virtual machines through a variety of consoles and CLI tools
  • Importing and cloning existing virtual machines, including VMware virtual machines
  • Managing network interface controllers and storage disks attached to virtual machines
  • Live migrating virtual machines between nodes

An enhanced web console provides a graphical portal to manage these virtualized resources alongside the OpenShift Container Platform cluster containers and infrastructure.

1.1.2. Container-native virtualization support

Important

container-native virtualization is a Technology Preview feature only. Technology Preview features are not supported with Red Hat production service level agreements (SLAs) and might not be functionally complete. Red Hat does not recommend using them in production. These features provide early access to upcoming product features, enabling customers to test functionality and provide feedback during the development process.

For more information about the support scope of Red Hat Technology Preview features, see https://access.redhat.com/support/offerings/techpreview/.

1.2. Preparing your cluster for container-native virtualization

Container-native virtualization 2.0 works with OpenShift Container Platform by default, however the following installation configurations are recommended:

  • The OpenShift Container Platform cluster is installed on bare metal. Manage your Compute nodes in accordance with the number and size of the virtual machines to host in the cluster.
  • Monitoring is configured in the cluster.

1.3. Installing container-native virtualization

Install container-native virtualization to add virtualization functionality to your OpenShift Container Platform cluster.

Before you deploy container-native virtualization, you must create two Custom Resource Definition (CRD) objects:

  • kind: OperatorGroup
  • kind: CatalogSource

You can create both objects by running a single command.

To finish installing container-native virtualization, use the OpenShift Container Platform 4.1 web console to subscribe to and deploy the container-native virtualization Operators.

Important

container-native virtualization is a Technology Preview feature only. Technology Preview features are not supported with Red Hat production service level agreements (SLAs) and might not be functionally complete. Red Hat does not recommend using them in production. These features provide early access to upcoming product features, enabling customers to test functionality and provide feedback during the development process.

For more information about the support scope of Red Hat Technology Preview features, see https://access.redhat.com/support/offerings/techpreview/.

1.3.1. Preparing to install container-native virtualization

Before deploying container-native virtualization:

  • Create a namespace called kubevirt-hyperconverged.
  • Create OperatorGroup and CatalogSource Custom Resource Definition objects (CRDs) in the kubevirt-hyperconverged namespace.

Prerequisites

  • OpenShift Container Platform 4.1
  • User with cluster-admin privileges
  • The OpenShift Container Platform Command-line Interface (CLI), commonly known as oc

Procedure

  1. Create the kubevirt-hyperconverged namespace by running the following command:

    $ oc new-project kubevirt-hyperconverged
  2. Create the OperatorGroup and CatalogSource in the kubevirt-hyperconverged namespace by running the following command:

    cat <<EOF | oc apply -f -
    apiVersion: operators.coreos.com/v1alpha2
    kind: OperatorGroup
    metadata:
      name: hco-operatorgroup
      namespace: kubevirt-hyperconverged
    ---
    apiVersion: operators.coreos.com/v1alpha1
    kind: CatalogSource
    metadata:
      name: hco-catalogsource
      namespace: openshift-operator-lifecycle-manager
      imagePullPolicy: Always
    spec:
      sourceType: grpc
      image: registry.redhat.io/container-native-virtualization/hco-bundle-registry:v2.0.0
      displayName: KubeVirt HyperConverged
      publisher: Red Hat
    EOF

1.3.2. Subscribing to the KubeVirt HyperConverged Cluster Operator catalog

Before you install container-native virtualization, subscribe to the KubeVirt HyperConverged Cluster Operator catalog from the OpenShift Container Platform web console. Subscribing gives the kubevirt-hyperconverged namespace access to the container-native virtualization Operators.

Prerequisites

  • OperatorGroup and CatalogSource Custom Resource Definition objects (CRDs), both created in the kubevirt-hyperconverged namespace

Procedure

  1. Open a browser window and navigate to the OpenShift Container Platform web console.
  2. Select the kubevirt-hyperconverged project from the Projects list.
  3. Navigate to the Catalog Operator Management page.
  4. In the Operator Catalogs tab, locate KubeVirt HyperConverged Cluster Operator and click Create Subscription.
  5. Click Create to launch the container-native virtualization Operators.

1.3.3. Deploying container-native virtualization

After subscribing to the KubeVirt HyperConverged Cluster Operator catalog, create the KubeVirt HyperConverged Cluster Operator Deployment custom resource to deploy container-native virtualization.

Prerequisites

  • An active subscription to the KubeVirt HyperConverged Cluster Operator catalog in the kubevirt-hyperconverged namespace

Procedure

  1. Navigate to the Catalog Installed Operators page.
  2. Click KubeVirt HyperConverged Cluster Operator.
  3. Click the KubeVirt HyperConverged Cluster Operator Deployment tab and click Create HyperConverged.
  4. Click Create to launch container-native virtualization.
  5. Navigate to the Workloads Pods page and monitor the container-native virtualization Pods until they are all Running. After all the Pods display the Running state, you can access container-native virtualization.
Note

You can verify the installation by navigating to the web console at kubevirt-web-ui.your.app.subdomain.host.com. Log in by using your OpenShift Container Platform credentials.

1.4. Installing the virtctl client

The virtctl client is a command-line utility for managing container-native virtualization resources.

Install the client to your system by enabling the container-native virtualization repository and installing the kubevirt-virtctl package.

1.4.1. Enabling container-native virtualization repositories

Red Hat offers container-native virtualization repositories for both Red Hat Enterprise Linux 8 and Red Hat Enterprise Linux 7:

  • Red Hat Enterprise Linux 8 repository: cnv-2.0-for-rhel-8-x86_64-rpms
  • Red Hat Enterprise Linux 7 repository: rhel-7-server-cnv-2.0-rpms

The process for enabling the repository in subscription-manager is the same in both platforms.

Procedure

  • Use subscription manager to enable the appropriate container-native virtualization repository for your system:

    # subscription-manager repos --enable <repository>

1.4.2. Installing the virtctl client

Install the virtctl client from the kubevirt-virtctl package.

Procedure

  • Install the kubevirt-virtctl package:

    # yum install kubevirt-virtctl

See also: Using the CLI tools for container-native virtualization.

1.5. Uninstalling container-native virtualization

You can uninstall container-native virtualization by using the OpenShift Container Platform 4.1 web console. First, delete the custom resource you created during deployment. Then, delete the KubeVirt HyperConverged Cluster Operator catalog subscription.

Prerequisites

  • Container-native virtualization 2.0

1.5.1. Deleting the KubeVirt HyperConverged custom resource

To uninstall container-native virtualization, you must delete the custom resource that you created during deployment.

Prerequisites

  • An active KubeVirt HyperConverged Cluster Operator Deployment custom resource

Procedure

  1. From the OpenShift Container Platform web console, select kubevirt-hyperconverged from the Projects list.
  2. Navigate to the Catalog Installed Operators page.
  3. Click KubeVirt HyperConverged Cluster Operator.
  4. Click the KubeVirt HyperConverged Cluster Operator Deployment tab.
  5. Click the Options menu kebab in the row containing the kubevirt-hyperconverged custom resource. In the expanded menu, click Delete HyperConverged.
  6. Click Delete in the confirmation window.
  7. Navigate to the Workloads Pods page to verify that only the Operator Pods are running.
  8. Open a terminal window and clean up the remaining KubeVirt resources by running the following command:

    $ oc delete apiservices v1alpha3.subresources.kubevirt.io -n kubevirt-hyperconverged
    Note

    Because some KubeVirt resources are currently improperly retained, you must manually remove them. These resources will be removed automatically after (BZ1712429) is resolved.

1.5.2. Deleting the KubeVirt HyperConverged Cluster Operator catalog subscription

To finish uninstalling container-native virtualization, delete your KubeVirt HyperConverged Cluster Operator catalog subscription.

Prerequisites

  • An active KubeVirt HyperConverged Cluster Operator catalog subscription

Procedure

  1. From the OpenShift Container Platform web console, select kubevirt-hyperconverged from the Projects list.
  2. Navigate to the Catalog Operator Management page.
  3. Click the Operator Subscriptions tab.
  4. Click the Options menu kebab in the row that contains the hco-subscription subscription. In the expanded menu, click Remove Subscription.
  5. Ensure that the Also completely remove the Operator from the selected namespace check box is selected. If it is not selected, Operator Pods will remain in Workloads Pods when the subscription is removed.
  6. Confirm that you want to remove the subscription by clicking Remove again.
Note

You can now delete the kubevirt-hyperconverged namespace.

1.5.3. Deleting a project using the web console

Procedure

  1. Navigate to Home Projects.
  2. Locate the project that you want to delete from the list of projects.
  3. On the far right side of the project listing, select Delete Project from the menu. If you do not have permissions to delete the project, the Delete Project option is grayed out and the option is not clickable.
Red Hat logoGithubRedditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

© 2024 Red Hat, Inc.