Not everything runs in containers. Legacy applications, Windows workloads, kernel-dependent software, and compliance-mandated VMs still need virtual machines. KubeVirt lets you manage both VMs and containers with the same Kubernetes tools.
How KubeVirt Works
KubeVirt adds a VirtualMachine CRD to Kubernetes. VMs run inside pods, managed by the same scheduler, networking, and storage systems as containers.
kubectl get pods → shows containers AND VMs
kubectl get vms → shows virtual machinesInstallation
# Install KubeVirt operator
kubectl apply -f https://github.com/kubevirt/kubevirt/releases/latest/download/kubevirt-operator.yaml
# Install KubeVirt CR
kubectl apply -f https://github.com/kubevirt/kubevirt/releases/latest/download/kubevirt-cr.yaml
# Wait for deployment
kubectl wait -n kubevirt kv kubevirt --for=condition=Available --timeout=5m
# Install virtctl CLI
kubectl krew install virtMaster this topic with hands-on labs
Go beyond reading — build real projects in sandboxed environments with expert video guidance.
Browse Courses →Create a Virtual Machine
apiVersion: kubevirt.io/v1
kind: VirtualMachine
metadata:
name: ubuntu-vm
spec:
running: true
template:
metadata:
labels:
app: ubuntu-vm
spec:
domain:
devices:
disks:
- name: rootdisk
disk:
bus: virtio
- name: cloudinit
disk:
bus: virtio
interfaces:
- name: default
masquerade: {}
resources:
requests:
memory: 2Gi
cpu: "2"
networks:
- name: default
pod: {}
volumes:
- name: rootdisk
containerDisk:
image: quay.io/containerdisks/ubuntu:22.04
- name: cloudinit
cloudInitNoCloud:
userData: |
#cloud-config
password: changeme
chpasswd:
expire: false
ssh_authorized_keys:
- ssh-rsa AAAA...kubectl apply -f ubuntu-vm.yaml
# Check VM status
kubectl get vms
# NAME AGE STATUS READY
# ubuntu-vm 30s Running True
# Console access
virtctl console ubuntu-vm
# SSH access (via port-forward)
virtctl ssh ubuntu@ubuntu-vmExpose VM as a Service
VMs use standard Kubernetes networking:
apiVersion: v1
kind: Service
metadata:
name: ubuntu-vm-ssh
spec:
selector:
app: ubuntu-vm
ports:
- port: 22
targetPort: 22
type: ClusterIPOther pods in the cluster access the VM via ubuntu-vm-ssh:22. LoadBalancer or Ingress work the same as for container services.
Live Migration
Move a running VM between nodes without downtime:
# Migrate VM to another node
virtctl migrate ubuntu-vm
# Check migration status
kubectl get vmimUseful for node maintenance: drain a node and VMs migrate automatically.
Get weekly IT automation tips
Docker, Ansible, Terraform, MLOps — curated insights delivered to your inbox. No spam.
Subscribe Free →Persistent Storage
volumes:
- name: data
persistentVolumeClaim:
claimName: vm-data-pvcVMs use the same PVCs as containers. Any CSI storage driver works.
Use Cases
Legacy Application Migration
Run Windows Server or older Linux applications that cannot be containerized:
domain:
resources:
requests:
memory: 4Gi
cpu: "4"
devices:
disks:
- name: windows
disk:
bus: sata
volumes:
- name: windows
persistentVolumeClaim:
claimName: windows-server-diskDevelopment Environments
Developers who need full OS environments (kernel modules, systemd, specific distros):
# Spin up a Fedora VM for testing
virtctl create vm --name test-fedora --image quay.io/containerdisks/fedora:39Hybrid Architectures
Frontend containers talk to VM-hosted legacy databases. Both managed by Kubernetes:
[Container: API Gateway] → [Container: Auth Service] → [VM: Oracle Database]
↓
[Container: Web Frontend]All connected via Kubernetes networking. All deployed with kubectl apply.
When to Use KubeVirt
Good fit: - Migrating from VMware/OpenStack to Kubernetes gradually - Running Windows workloads alongside Linux containers - Applications requiring full OS (systemd, kernel modules) - Organizations standardizing on Kubernetes for all workloads
Not needed: - All workloads are already containerized - You have a working VM platform (vSphere, Proxmox) with no migration plans - Small-scale deployments where VMs on bare metal are simpler
KubeVirt is a migration tool. The end goal is containers, but KubeVirt bridges the gap for workloads that cannot be containerized yet.
---
Ready to go deeper? Master Kubernetes infrastructure with hands-on courses at CopyPasteLearn.
Ready to learn by doing?
Stop reading tutorials — start building. Expert video courses with hands-on labs in real sandboxed environments.
Related Articles
Podman vs Docker in 2026
Podman and Docker both run containers but differ in architecture. Compare rootless containers, daemon requirements, Compose support, and Kubernetes.
kubectl Cheat Sheet for DevOps
Essential kubectl commands for pods, deployments, services, logs, and debugging Kubernetes clusters. Copy-paste ready DevOps reference.
Talos Linux for Kubernetes
Talos Linux is a minimal, immutable OS designed exclusively for running Kubernetes. Learn why it exists, how it works, and when to use it instead of Ubuntu.
Kustomize Kubernetes Configuration
Kustomize customizes Kubernetes manifests without templates using overlays and patches. Learn how to manage multiple environments, merge configurations.
Kyverno Kubernetes Policy Engine
Kyverno validates, mutates, and generates Kubernetes resources using YAML policies instead of Rego. Learn how to enforce security standards, set defaults.
Learn Ansible Free: Beginner Guide
Start learning Ansible for free with hands-on examples. Master playbooks, inventory, modules, and roles to automate infrastructure.
Explore topics
Browse more articles on the topics covered here.