OpenShift Virtualization - General Overview
OpenShift Virtualization - General Overview
1
Gartner predicts that, by 2022, more than
75% of global organizations will be running
containerized applications in production,
which is a significant increase from fewer than
30% in 2019.
2
The move from Virtual Machines to Containers
Accelerate Digital Transformations Increase Operational Efficiency and Standardization
Most are
Cloud Native here
Environments
Time
Legacy VM
Environments
4
What is OpenShift
Virtualization?
5
Containers are not virtual machines
● Containers are process isolation
● Kernel namespaces provide isolation and
cgroups provide resource controls App 1 App 2 App 3
Virtualization Containerization
6
Virtual machines can be put into containers
● A KVM virtual machine is a process
● Containers encapsulate processes
● Both have the same underlying
resource needs:
○ Compute
○ Network
○ (sometimes) Storage
7
KubeVirt becomes a CNCF FOR INTERNAL USE ONLY
30 337 133
Releases (since Sandbox) Contributors Contributing Companies
“KubeVirt collaborates and integrates with many other Cloud Native projects. Foremost with
building on top of and aligning with Kubernetes and its principles to provide a consistent user
experience. KubeVirt is built to be complemented by other projects to extend its feature set:
Service Meshes (Istio), Automation (Tekton, ArgoCD), and workload migration (Konveyor).”
8
ttps://www.cncf.io/blog/2022/04/19/kubevirt-becomes-a-cncf-incubating-project/
h
OpenShift Virtualization
● Virtual machines
○ Running in containers, managed as Pods
○ Using the KVM hypervisor
● Scheduled, deployed, and managed by Kubernetes
● Integrated with container orchestrator resources and
services
○ Traditional Pod-like SDN connectivity and/or
connectivity to external VLAN and other networks
via multus
○ Persistent storage paradigm (PVC, PV,
StorageClass)
9
VM containers use KVM
● OpenShift Virtualization uses KVM, the Linux kernel
hypervisor
● KVM is a core component of the Red Hat Enterprise
Linux kernel OTHER APPS libvirt
QEMU
○ KVM has 10+ years of production use: Red Hat
Virtualization, Red Hat OpenStack Platform, and RHCOS
RHEL all leverage KVM, QEMU, and libvirt KVM
HARDWARE
10
Built with
Kubernetes
11
Virtual machines in a container world
● Provides a way to transition application components
which can’t be directly containerized into a Kubernetes
system
○ Integrates directly into existing k8s clusters
○ Follows Kubernetes paradigms:
VM pod App pod
■ Container Networking Interface (CNI)
■ Container Storage Interface (CSI)
OpenShift
■ Custom Resource Definitions (CRD, CR)
● Schedule, connect, and consume VM resources as
RHEL CoreOS
container-native
Physical Machine
12
Virtualization native to Kubernetes
● Operators are a Kubernetes-native way to introduce
new capabilities
● New CustomResourceDefinitions (CRDs) for native
VM integration, for example:
○ VirtualMachine
○ VirtualMachineInstance
○ VirtualMachineInstanceMigration
○ VirtualMachineSnapshot
○ DataVolume
13
Containerizing KVM
Trusted, mature KVM wrapped in modern management and automation
VM VM VM
libvirt Security Kubernetes Security libvirt Security
15
Comparing with
traditional
virtualization
platforms
16
Live Migration
● Live migration moves a virtual machine from one node to another in the OpenShift cluster
● Can be triggered via GUI, CLI, API, or automatically
● RWX storage is required
● Live migration is cancellable by deleting the API object
● Default maximum of five (5) simultaneous live migrations
○ Maximum of two (2) outbound migrations per node, 64MiB/s throughput each
17
Automated live migration
● OpenShift / Kubernetes triggers Pod rebalance actions based on multiple factors
○ Soft / hard eviction policies
○ Pod descheduler
○ Pod disruption policy
○ Node resource contention resulting in evictions
■ Pods are Burstable QoS class by default
■ All memory is requested in Pod definition, only CPU overhead is requested
● Pod rebalance applies to VM pods equally
● VMs will behave according to the eviction strategy
○ LiveMigrate - use live migration to move the VM to a different node
○ No definition - terminate the VM if the node is drained or Pod evicted
18
VM scheduling
● VM scheduling follows pod scheduling rules
○ Node selectors
○ Taints / tolerations
○ Pod and node affinity / anti-affinity
● Kubernetes scheduler takes into account many additional factors
○ Resource load balancing - requests and reservations
○ Large / Huge page support for VM memory
○ Use scheduler profiles to provide additional hints (for all Pods)
● Resources are managed by Kubernetes
○ CPU and RAM requests less than limit - Burstable QoS by default
○ K8s QoS policy determines scheduling priority: BestEffort class is evicted before
Burstable class, which is evicted before Guaranteed class
19
Node Resource Management
● VM density is determined by multiple factors controlled at the cluster, OpenShift Virtualization,
Pod, and VM levels
● Pod QoS policy
○ Burstable (limit > request) allows more overcommit, but may lead to more frequent
migrations
○ Guaranteed (limit = request) allows less overcommitment, but may have less physical resource
utilization on the hosts
● Cluster Resource Override Operator provides global overcommit policy, can be customized per
project for additional control
● Pods request full amount of VM memory and approx. 10% of VM CPU
○ VM pods request a small amount of additional memory, used for libvirt/QEMU overhead
■ Administrator can set this to be overcommitted
20
High availability
● Node failure is detected by Kubernetes and results in the Pods from the lost node being
rescheduled to the surviving nodes
● VMs are not scheduled to nodes which have not had a heartbeat from virt-handler, regardless of
Kubernetes node state
● Additional monitoring may trigger automated action to force stop the VM pods, resulting in
rescheduling
○ May take up to 5 minutes for virt-handler and/or Kubernetes to detect failure
○ Liveness and Readiness probes may be configured for VM-hosted applications
○ Machine health checks can decrease failure detection time
21
Terminology comparison
Feature RHV OpenShift Virtualization vSphere
Active resource balancing Cluster scheduling policy Pod eviction policy, descheduler Dynamic Resource
Scheduling (DRS)
Physical network Host network config (via nmstate Operator, Multus vSwitch / DvSwitch
configuration nmstate w/4.4)
Host / VM metrics Data warehouse + OpenShift Metrics, health checks vCenter, vROps
Grafana (RHV 4.4)
22
Runtime
awareness
23
Compute configuration
● VM nodes should be physical with CPU virtualization technology enabled in the BIOS
○ Nested virtualization works, but is not supported
○ Emulation works, but is not supported (and is extremely slow)
● Node labeler detects CPU type and labels nodes for compatibility and scheduling
● Configure overcommitment using native OpenShift functionality - Cluster Resource Override
Operator
○ Optionally, customize the project template so that non-VM pods are not overcommitted
○ Customize projects hosting VMs for overcommit policy
● Apply Quota and LimitRange controls to projects with VMs to manage resource consumption
● VM definitions default to all memory “reserved” via a request, but only a small amount of CPU
○ CPU and memory request/limit values are modified in the VM definition
24
Storage configuration
● Shared storage is not required, but very highly encouraged
○ Live migration depends on RWX PVCs
● Create shared storage from local resources using OpenShift Container Storage
○ RWX file and block devices for live migration
● No preference for storage protocol, use what works best for the application(s)
● Storage backing PVs should provide adequate performance for VM workload
○ Monitor latency from within VM, monitor throughput from OpenShift
● For IP storage (NFS, iSCSI), consider using dedicated network interfaces
○ Will be used for all PVs, not just VM PVs
● Certified CSI drivers are recommended
○ Many non-certified CSI provisioners work, but do not have same level of OpenShift testing
● Local storage may be utilized via the Host Path Provisioner
25
Customer Use
Cases
26
Who’s using OpenShift Virtualization
27
Who’s using OpenShift Virtualization
28
MIGRATION TOOLKIT FOR VIRTUALIZATION
Migration Analytics
Detect potential compatibility issues before
migrating to ensure a successful migration
youtube.com/user/RedHatVideos
Red Hat is the world’s leading provider of enterprise
30