How leahsinger14/kubevirt works
KubeVirt adds VM resources and virtualization controllers/agents to Kubernetes. A user submits VM intent through the API; admission validates and mutates it, the controller reconciles it into a scheduled launcher pod, and the node handler prepares networking/devices and manages the VM through virt-launcher and libvirt. The repository also contains distinct storage, migration, snapshot/export, console/API, and monitoring capabilities. The README documents declarative VM lifecycle; component paths come from the tree, while sampled excerpts provide only partial implementation detail, so uncertain internal calls are omitted.
Main entry points: virt-api.go virt-api · virt-controller.go virt-controller · controller.go Node reconciliation · virt-handler.go virt-handler
Components 23
API and admission
- virt-api
cmd/virt-api/virt-api.go - API endpoints
pkg/virt-api/rest - Admission webhooks
pkg/virt-api/webhooks
VM control plane
- virt-controller
cmd/virt-controller/virt-controller.go - VM reconciliation
pkg/virt-controller/watch/vm/vm.go - VMI reconciliation
pkg/virt-controller/watch/vmi/vmi.go - Launcher pod rendering
pkg/virt-controller/services/template.go - virt-operator
cmd/virt-operator/virt-operator.go
Node execution
- virt-handler
cmd/virt-handler/virt-handler.go - Node reconciliation
pkg/virt-handler/controller.go - virt-launcher
cmd/virt-launcher/virt-launcher.go - Libvirt domain manager
pkg/virt-launcher/virtwrap/manager.go - Hypervisor runtime
pkg/hypervisor/virt-runtime.go - Network setup
pkg/network/setup/launcher/configurator.go
Storage and mobility
- Storage controllers
pkg/virt-controller/watch/vmi/storage.go - Backend storage
pkg/storage/backend-storage/backend-storage.go - Snapshots and restore
pkg/storage/snapshot/snapshot.go - VM export
pkg/storage/export/export/export.go - Migration synchronization
pkg/synchronization-controller/synchronization-controller.go
Access and observability
- virtctl
cmd/virtctl/virtctl.go - Metrics and alerts
pkg/monitoring/rules/rules.go
Other components
- VM operator
- Kubernetes API
Connections 24
- VM operator → virt-api: submits VM request
- virt-api → API endpoints: routes requests
- virt-api → Admission webhooks: validates admission
- virt-api → Kubernetes API: reads and writes resources
- virt-controller → Kubernetes API: watches resources
- virt-controller → VM reconciliation: reconciles VMs
- virt-controller → VMI reconciliation: reconciles VMIs
- VM reconciliation → Launcher pod rendering: renders launcher pod
- Launcher pod rendering → Kubernetes API: creates pod resources
- virt-controller → Storage controllers: reconciles volume status
- Storage controllers → Backend storage: creates backend PVCs
- virt-handler → Node reconciliation: runs node control
- Node reconciliation → Kubernetes API: reads and patches VMI
- Node reconciliation → Network setup: sets up networking
- Node reconciliation → virt-launcher: manages launcher
- virt-launcher → Libvirt domain manager: manages domains
- Libvirt domain manager → Hypervisor runtime: controls VM runtime
- Migration synchronization → Kubernetes API: synchronizes migration state
- VM operator → virtctl: runs VM commands
- virtctl → virt-api: calls API
- virt-api → Snapshots and restore: snapshot API
- virt-api → VM export: export API
- virt-handler → Metrics and alerts: provides runtime metrics
- virt-operator → Kubernetes API: manages cluster resources