Virtualization technology has become the cornerstone of modern data centers, enabling consolidation, resource flexibility, and efficient workload management. 

This blog delves into the technical details vSphere and KubVirt, compares their core features, and explores the use case for each platform.

vSphere

vSphere is a virtualization platform developed by VMware. It aggregated computing infrastructures that include compute, storage, and networking resources.
The platform manages these infrastructures as a unified operating environment, providing tools for administering the participating data centers. Key components of vSphere include ESXi (hypervisor), vCenter Server (centralized management), and other software components can provide additional features like software defined storage & networking.

KubeVirt

KubeVirt is an open-source project that bridges the gap between Kubernetes and virtual machines (VMs), that provides a single deployment and management plane for both containers and VMs. This unified approach allows cloud-native applications to run seamlessly, regardless of whether they require containers or VMs. Developers can build, modify, and deploy applications residing in both application containers and VMs within a shared environment.
With KubeVirt, VM workloads can be run as pods inside a Kubernetes cluster. KubeVirt addresses the needs of development teams with existing VM-based workloads. It allows developers to build, modify, and deploy applications residing in both application containers and VMs within a shared environment.
KubeVirt is also available via enterprise Kubernetes distributions like RedHat OpenShift Container Platform.

Use cases for each platform

VMware vSphere stands out as a leading choice for enterprise customers managing large-scale VM environments. Its robust suite of virtualization products provides a scalable platform for running virtual machines and orchestrating containers. Built on the solid foundation of VMware ESXi and vCenter Server, vSphere offers advanced features like vMotion, High Availability, and Distributed Resource Scheduler. These features are particularly beneficial for enterprises that prioritize minimizing downtime, ensuring high availability, and achieving resource efficiency in large-scale environments. 
VMs are first class citizens on vSphere and the system architecture is based on how to run and manage VMs efficiently.

On the other hand, KubeVirt shines in scenarios where customers are running VMs and containers side by side and are on a journey of containerization. As an open-source project, KubeVirt enables traditional virtual machines to run on top of Kubernetes, allowing you to manage VMs like any other Kubernetes resource. This tight integration with the Kubernetes ecosystem is particularly beneficial for organizations that are heavily invested in cloud-native technologies and are looking to bring their existing, non-containerized workloads into a Kubernetes environment. 
Enterprise Kubernetes distributions provide customers a curated experience and enterprise level support.

The following table compares features and components of each platform.

Comparison Table

Feature vSphere KubeVirt
Core Components ESXi (hypervisor),  vCenter Server (central management) Custom Resource Definitions (CRDs) for VM management, virt-controller, virt-launcher, virt-handler, libvirtd
Virtual Machine Management Comprehensive VM management using GUI (vCenter), CLI or API Declarative VM creation and management directly from a Kubernetes cluster
High Availability High Availability (HA) feature ensures high availability of applications running in VMs Depending underlying Kubernetes cluster’s high availability configuration
Resource Management Distributed Resource Scheduler (DRS) for automatic balancing of resources Resources managed by Kubernetes, allowing for automatic scaling and load balancing
Security Comprehensive built-in security starting at the core Security depends on underlying Kubernetes cluster’s configuration
Integration with Kubernetes Tanzu integration or Kubernetes inside VMs DIY or Enterprise Distributions Native integration with Kubernetes, allowing VMs to run as standard Kubernetes pods
Container Support Supports running containers inside VMs Supports running containers natively
Live Migration of VMs vMotion allows for live migration of running VMs Supports live migration of VMs between nodes
Scalability Scalable to support large enterprise environments Scalability depends on underlying Kubernetes cluster’s configuration
Storage Supports a variety of storage options including local, SAN, NAS, and vSAN Storage managed by Kubernetes, supports any storage class available in the cluster
Disaster Recovery VMware Site Recovery Manager for orchestrated failover using async and sync-replication technologies 3rd part solutions and storage based replication technologies
Networking Advanced networking features with distributed switches and NSX. Networking managed by Kubernetes and supports any network plugin available in the cluster
Licensing Subscription based licenses Free as part of Kubernetes or licensed via Enterprise Kubernetes Distributions


Comparing Operational Aspects

This builds upon the previous comparison, focusing on VM creation, cloning, migration, and storage management with Kubvirt and vSphere:

VM Creation:

  • vSphere:

    • vSphere Client or PowerCLI cmdlets can be used for VM creation.

    • ESXi hosts are selected for VM placement.

    • Resource allocation (CPU, memory, storage) is defined during creation.


  • Kubvirt:

    • YAML manifests or kubectl commands are used to define VM configuration.

    • Resource requests and limits are specified for CPU, memory, and storage.

    • Networking and storage details are included in the manifest.

    • Example (manifest):

      apiVersion: kubevirt.io/v1
      kind: VirtualMachine
      metadata:
        name: my-vm
      spec:
        template:
          spec:
            domain:
              name: my-vm
            networks:
            - name: default
              interfaceName: eth0
            resources:
              requests:
                memory: "2Gi"
                cpu: "1"
            volumes:
            - name: ubuntu-disk
              persistentVolumeClaim:
                claimName: ubuntu-pvc
      

VM Cloning from Template:

  • vSphere:

    • Templates are created from existing VMs with desired configuration.
    • New VMs can be cloned from templates with pre-configured settings.
  • Kubvirt:

    • VM templates can be defined as YAML manifests with base configurations.

    • New VMs are created referencing the template manifest, inheriting the configuration.

    • Example (template manifest):

      apiVersion: kubevirt.io/v1
      kind: VirtualMachineInstanceTemplate
      metadata:
        name: my-vm-template
      spec:
        domain:
          name: my-vm-template
        networks:
        - name: default
          interfaceName: eth0
        resources:
          requests:
            memory: "2Gi"
            cpu: "1"
      
      • New VM using Template:

        apiVersion: kubevirt.io/v1
        kind: VirtualMachine
        metadata:
          name: my-vm-clone
        spec:
          template:
            spec:
              templateRef:
                name: my-vm-template
        

VM Migration to Another Node:

  • vSphere:

    • vSphere offers vMotion for live migration of running VMs between ESXi hosts with minimal downtime.
    • Prerequisites include shared storage and compatible hardware on both hosts.
  • Kubvirt:

    • Live migration is initiated by posting a VirtualMachineInstanceMigration (VMIM) object to the cluster. The example below starts a migration process for a virtual machine instance rhel01
Example (manifest):
apiVersion: kubevirt.io/v1
kind: VirtualMachineInstanceMigration
metadata:
    name: migration-job
spec:
    vmiName: rhel01


VM Migration to Another Volume:

  • vSphere:

    • Storage vMotion can be used to migrate VM disks between datastores while the VM is running.
    • Prerequisites include shared storage and compatible datastores.

  • Kubvirt:

    • Kubvirt relies on Kubernetes storage features for volume management. Shutdown the Virtual Machine.
    • Use kubectl cp to copy data from one PVC to another. 
    • Update and apply the persistent volume claim (PVC) associated with the VM's storage in the YAML manifest.
    • Start the Virtual Machine.


Conclusion

In conclusion, both VMware vSphere and KubeVirt offer robust solutions for managing virtual machines, each with its unique strengths.
vSphere is ideally suited for enterprises with large-scale environments, while KubeVirt is an excellent choice for those on a journey of containerization, seeking to manage both their VM-based and container workloads using the same set of tools. The choice between the two will depend on the specific needs and nature of your workloads.