2 Installing the KubeVirt Module
This chapter discusses how to install the KubeVirt module on Oracle Cloud Native Environment.
Prerequisites
This section contains the prerequisites for installing the KubeVirt module.
Setting up Persistent Storage
We recommend that you set up storage for KubeVirt virtual machines to maintain state over reboots and live migration. You might want to use a CephFilesystem that's made available using a StorageClass. CephFilesystem is a ReadWriteMany file system, which is required to maintain state. The Rook module can be used to set up CephFilesystem storage. For information on setting up a CephFilesystem and StorageClass using the Rook module, see Rook Module.
Setting up a Container Registry
KubeVirt pulls containerized virtual machine images from a container registry. The Kubernetes nodes need to have access to a container registry with the appropriately configured container images to create virtual machines with KubeVirt.
You can set up a container registry using Podman, Oracle Container Runtime for Docker, or any other container registry software. For information creating a Podman local container registry, see Oracle Linux: Podman User's Guide. For information on creating an Oracle Container Runtime for Docker container registry, see Oracle Linux: Oracle Container Runtime for Docker User's Guide.
Creating a KubeVirt Configuration File
To perform any advanced configuration for KubeVirt, you can optionally provide a KubeVirt configuration file. This lets you set up or override any KubeVirt settings such as debug logging or emulation options, when you deploy the KubeVirt module. The KubeVirt objects that you can override are listed in the upstream KubeVirt documentation.
Provide a KubeVirt configuration file on the operator node in YAML format. The high level structure for this file would look similar to:
apiVersion: kubevirt.io/v1
kind: KubeVirt
metadata:
annotations: {}
labels: {}
name: {}
namespace: {}
spec: {}
The Platform API Server uses the information contained in the configuration file when creating the KubeVirt module. KubeVirt performs all the set up and configuration for KubeVirt, using the information you provide in this file.
Deploying the KubeVirt Module
You can deploy all the modules required to set up KubeVirt using a single olcnectl
module create
command. This method might be useful if you want to deploy the
KubeVirt module at the same time as deploying a Kubernetes cluster.
If you have an existing deployment of the Kubernetes module, you can specify that instance when deploying the KubeVirt module.
This section guides you through installing each component required to deploy the KubeVirt module.
For the full list of the Platform CLI command options available when creating modules, see
the olcnectl module create
command in Platform Command-Line Interface.
To deploy the KubeVirt module:
-
If you don't already have an environment set up, create one into which the modules can be deployed. For information on setting up an environment, see Installation. The name of the environment in this example is
myenvironment
. -
If you don't already have a Kubernetes module set up or deployed, set one up. For information on adding a Kubernetes module to an environment, see Kubernetes Module. The name of the Kubernetes module in this example is
mycluster
. -
Create a KubeVirt module and associate it with the Kubernetes module named
mycluster
using the--kubevirt-kubernetes-module
option. In this example, the KubeVirt module is namedmykubevirt
.olcnectl module create \ --environment-name myenvironment \ --module kubevirt \ --name mykubevirt \ --kubevirt-kubernetes-module mycluster
The
--module
option sets the module type to create, which iskubevirt
. You define the name of the KubeVirt module using the--name
option, which in this case ismykubevirt
.The
--kubevirt-kubernetes-module
option sets the name of the Kubernetes module.If you don't include all the required options when adding the module, you're prompted to provide them.
-
Use the
olcnectl module install
command to install the KubeVirt module. For example:olcnectl module install \ --environment-name myenvironment \ --name mykubevirt
You can optionally use the
--log-level
option to set the level of logging displayed in the command output. By default, error messages are displayed. For example, you can set the logging level to show all messages when you include:--log-level debug
The log messages are also saved as an operation log. You can view operation logs as commands are running, or when they've completed. For more information using operation logs, see Platform Command-Line Interface.
The KubeVirt module is deployed into the Kubernetes cluster.
- You might want to optionally install the KubeVirt CLI tools
virtctl
andvirt-viewer
. These tools make managing many operations involving KubeVirt virtual machines easier. These tools are useful when accessing the virtual machine console and remote desktop. On a control plane node, install these tools:sudo dnf install virtctl virt-viewer
Verifying the KubeVirt Module Deployment
You can verify the KubeVirt module is deployed using
the olcnectl module instances
command on the
operator node. For example:
olcnectl module instances \
--environment-name myenvironment
The output looks similar to:
INSTANCE MODULE STATE
mycluster kubernetes installed
mykubevirt kubevirt installed
myrook rook installed
...
Note the entry for kubevirt
in the MODULE
column is in the
installed
state.
In addition, use the olcnectl module report
command to review information about the module. For example, use
the following command to review the KubeVirt module
named mykubevirt
in
myenvironment
:
olcnectl module report \
--environment-name myenvironment \
--name mykubevirt \
--children
For more information on the syntax for the olcnectl module report
command, see Platform Command-Line Interface.
On a control plane node, verify the virt-*
deployments are running in the
kubevirt
namespace:
kubectl get deployments --namespace kubevirt
The output looks similar to:
NAME READY UP-TO-DATE AVAILABLE AGE
virt-api 2/2 2 2 117m
virt-controller 2/2 2 2 116m
virt-operator 2/2 2 2 117m