Back to articles
AI & Cloud

KubeVirt: A Comprehensive Solution for Running Legacy VMs on Kubernetes

A detailed guide to deploying KubeVirt to run legacy virtual machines on Kubernetes, integrated with Cloud VPS and Dedicated Server services, enabling modern infrastructure...

DPTCloud Engineering4 min read
KubeVirt: A Comprehensive Solution for Running Legacy VMs on Kubernetes

Introduction to KubeVirt and Running Legacy VMs on Kubernetes

KubeVirt is an open-source project built on Kubernetes that enables you to run virtual machines (VMs) as regular pods. With KubeVirt, you can operate legacy VMs—such as old Windows or Linux systems, or applications sensitive to their environment—on a Kubernetes platform without leaving the container ecosystem. This makes it a comprehensive solution for businesses looking to modernize infrastructure while maintaining legacy applications that cannot easily be containerized.

KubeVirt extends the Kubernetes API to support virtual machine resources, including VirtualMachine (VM) and VirtualMachineInstance (VMI), along with related components like PersistentVolume, Network, and Storage. Once deployed, KubeVirt creates a virtualization layer that integrates Kubernetes with VMs, allowing full lifecycle management—from creation and boot-up to orchestration, monitoring, and automation.

Prerequisites and Preparation for KubeVirt Deployment

To deploy KubeVirt, you need:

  • A functioning Kubernetes cluster, which can be hosted on a Cloud VPS or Dedicated Server.
  • Hardware with virtualization support (Intel VT-x or AMD-V).
  • Sufficient CPU, RAM, and storage resources to host legacy VMs.
  • Network resources, including static IPs or DHCP, and virtual network configuration.

For AI and inference workloads, Dedicated Server ensures high performance and stability. With Cloud VPS, you can quickly prototype and scale as needed.

Deploying KubeVirt on Kubernetes

To install KubeVirt, run the following commands:

curl -L https://github.com/kubevirt/kubevirt/releases/download/v0.56.0/kubevirt-operator.yaml -o kubevirt-operator.yaml
kubectl apply -f kubevirt-operator.yaml

After deployment, KubeVirt creates Custom Resource Definitions (CRDs) such as VirtualMachine and VirtualMachineInstance. You can create a legacy VM using a YAML definition like this:

apiVersion: kubevirt.io/v1
kind: VirtualMachine
metadata:
  name: legacy-vm
spec:
  running: true
  template:
    spec:
      domain:
        devices:
          disks:
          - name: rootdisk
            disk:
              bus: virtio
          interfaces:
          - name: default
            bridge: {}
        resources:
          requests:
            memory: 4Gi
      volumes:
      - name: rootdisk
        persistentVolumeClaim:
          claimName: legacy-pvc

Here, legacy-pvc refers to a previously created PersistentVolumeClaim containing the legacy OS or data.

Connecting and Managing Legacy VMs

Once the VM is created, you can access it via:

  • SSH, if the VM supports it.
  • Web console (VNC) using the KubeVirt Web UI or kubectl.
  • Kubernetes API for remote control.

To check the VM status, use:

kubectl get vm
kubectl get vmi

Optimization and Maintenance

To optimize performance, consider:

  • Using high-performance storage classes like local-path or glusterfs (see GlusterFS configuration guide).
  • Tailoring CPU and RAM allocation per VM based on actual needs.
  • Applying autoscaling policies for AI workloads.

Integration with Cloud VPS and Dedicated Server

For businesses using Cloud VPS or Dedicated Server, KubeVirt enables:

  • Integration with existing storage and network services.
  • Running legacy applications in a containerized environment.
  • Reducing operational costs by eliminating the need for separate physical infrastructure.

Troubleshooting and Notes

Common issues include:

  • VM fails to start: Check the logs of the virt-launcher pod.
  • No network connectivity: Verify CNI configuration (e.g., Calico, Flannel).
  • Storage not mounted: Confirm the PersistentVolumeClaim and storage class are correct.

To view detailed logs:

kubectl logs -n kubevirt virt-launcher-legacy-vm-xxxxx

References

DPTCloud Tier III Infrastructure

High-RAM Cloud VPS Plans Optimized for AI, Databases & Cache

Enterprise RAID 10 NVMe SSDs, CMC & FPT District 9 uplinks with Anycast Anti-DDoS and 99.99% SLA.

View 22 VPS Plans
ECO · vn-02Recommended

VPS-4E

297.000 ₫ / mo

10% VAT included

  • CPU: 4 vCPU
  • RAM: 8 GB
  • SSD: 50 GB NVMe
ECO · vn-02

VPS-5E

614.900 ₫ / mo

10% VAT included

  • CPU: 8 vCPU
  • RAM: 16 GB
  • SSD: 100 GB NVMe
ADVANCED · vn-03Recommended

VPS-4T

548.900 ₫ / mo

10% VAT included

  • CPU: 4 vCPU
  • RAM: 8 GB
  • SSD: 50 GB NVMe

Related Articles

View all
ZaloZalo SupportDiscord0384 753 478