kubeswift

module
v0.13.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 24, 2026 License: AGPL-3.0

README

KubeSwift

KubeSwift runs lightweight virtual machines as native Kubernetes workloads using Cloud Hypervisor. Use it for fast Linux and Windows VMs, GPU passthrough, VM fleets, snapshots, and live migration — without adopting a traditional virtualization stack.

Why KubeSwift

  1. Cloud Hypervisor first — the hypervisor for nearly every workload: disk-boot VMs, direct kernel-boot microVMs, and ephemeral OCI-image sandboxes (SwiftSandbox). QEMU is a secondary runtime, used only for HGX SXM (multi-GPU NVSwitch) topologies that need a PCIe hierarchy Cloud Hypervisor doesn't yet provide.
  2. Kubernetes-native operations — VMs are CRDs, reconciled by controllers like any other workload: kubectl, Services, fleets (SwiftGuestPool), GitOps, and Prometheus/Grafana observability all apply directly.
  3. Modern infrastructure workloads — GPU passthrough (native SwiftGPU or Kubernetes DRA), live migration with sub-second downtime, and OCI-registry-distributed VM artifacts (golden images, snapshots, cold migration).

Get started

helm install kubeswift oci://ghcr.io/kubeswift-io/charts/kubeswift \
  --version 0.13.2 \
  -n kubeswift-system \
  --create-namespace

Boot your first VM → Quickstart.

Host requirement: x86_64 Linux nodes with /dev/kvm (KVM).

Capabilities

  • Boot paths — disk boot from cloud images (Linux and Windows) and direct kernel boot from OCI artifacts (sub-second microVMs).
  • GPU passthrough — whole-GPU VFIO passthrough with two allocation backends: the native SwiftGPU model (discovery DaemonSet + profiles) or Kubernetes DRA ResourceClaims. PCIe GPUs on Cloud Hypervisor; HGX SXM on QEMU.
  • Networking — tap + bridge + DHCP with the guest IP surfaced in status; multi-NIC via Multus; SR-IOV NIC passthrough; OVN backends supported: OVN-Kubernetes and multi-node L2 with IP-preserving cross-node live migration (kube-ovn primary-on-NAD — see docs/networking/ovn-l2-install.md).
  • Services — expose guest ports as Kubernetes Services via spec.network.ports (ClusterIP/NodePort/LoadBalancer), a load-balanced Service across pool replicas via SwiftGuestPool.spec.service, and a VM→cluster egress reachability probe surfaced as EgressReady.
  • Storage — per-guest root-disk cloning sized from a class; optional data disks (blank/sized, image-backed, or attached PVC); RWX+Block for live-migration-capable volumes.
  • Snapshots & clones — disk-only (CSI) and memory+disk (local/S3) snapshots, scheduled snapshots, and cloneFromSnapshot for fast VM fan-out.
  • Sandboxes — ephemeral OCI-rootfs microVMs (SwiftSandbox) for CI runners, agent/code execution, and untrusted code; restricted-by-default egress, cosign verify-before-boot, and a block or virtio-fs rootfs. Warm pools (SwiftSandboxPool) keep pre-booted slots ready for sub-second checkout. GPU sandboxes pass a GPU through via the native SwiftGPU or DRA backend, with warm GPU pools and model preload (spec.model) for sub-second inference starts; spec.scratchDisk attaches a block disk for build caches or dataset staging.
  • OCI registry artifacts — golden VM images (SwiftImage.spec.source.oci + swiftctl image publish, cosign-signed with verify-on-pull) and VM snapshots / full-state cold migration (SwiftSnapshot backend.type: oci) stored in any OCI registry, for cross-cluster and edge distribution.
  • Migration — offline migration on any storage, and live migration (sub-second downtime) with optional mTLS transport and kubectl drain integration.
  • FleetsSwiftGuestPool gives ReplicaSet-style scaling with rolling updates, topology spread, and a PVC per replica.
  • Operationsswiftctl for console/SSH/lifecycle/describe; Prometheus metrics and Grafana dashboards across every feature; cloud-init via NoCloud; security-hardened containers (drop-ALL, no privileged).

Custom Resources

CRD Short API group Scope Purpose
SwiftGuest sg swift.kubeswift.io Namespaced A VM instance
SwiftGuestClass sgc swift.kubeswift.io Cluster CPU/memory/disk template
SwiftGuestPool sgpool swift.kubeswift.io Namespaced Fleet of identical VMs
SwiftImage si image.kubeswift.io Namespaced Disk image source
SwiftSeedProfile ssp seed.kubeswift.io Namespaced cloud-init (NoCloud) config
SwiftKernel sk kernel.kubeswift.io Namespaced Kernel + initramfs OCI artifact
SwiftGPUProfile sgp gpu.kubeswift.io Namespaced GPU passthrough request (native backend)
SwiftGPUNode sgn gpu.kubeswift.io Cluster Per-node GPU inventory
SwiftSnapshot ssnap snapshot.kubeswift.io Namespaced VM snapshot (disk or memory+disk)
SwiftRestore srst snapshot.kubeswift.io Namespaced Restore from a snapshot
SwiftSnapshotSchedule snapshot.kubeswift.io Namespaced Cron-scheduled snapshots + keep-N
SwiftMigration smig migration.kubeswift.io Namespaced Move a guest between nodes
SwiftSandbox sbox sandbox.kubeswift.io Namespaced Ephemeral OCI-rootfs microVM
SwiftSandboxPool sboxpool sandbox.kubeswift.io Namespaced Warm pool of pre-booted sandboxes for sub-second checkout
Cluster ksc fleet.kubeswift.io Namespaced Member cluster federated by the gateway hub

15 CRDs, all v1alpha1.

Documentation

Start at the documentation index. Common entry points:

Questions or problems: GitHub Issues.

Build

make build          # Go binaries
make build-images   # container images
make deploy         # apply CRDs + deploy the controller
go test ./...       # Go tests
cargo test          # Rust tests (from rust/)

Status

Pre-1.0; the v1alpha1 API may change between releases.

License

Licensed under the GNU Affero General Public License v3.0 (AGPL-3.0).

Directories

Path Synopsis
api
fleet/v1alpha1
+kubebuilder:object:generate=true +groupName=fleet.kubeswift.io
+kubebuilder:object:generate=true +groupName=fleet.kubeswift.io
gpu/v1alpha1
+kubebuilder:object:generate=true +groupName=gpu.kubeswift.io
+kubebuilder:object:generate=true +groupName=gpu.kubeswift.io
image/v1alpha1
+kubebuilder:object:generate=true +groupName=image.kubeswift.io
+kubebuilder:object:generate=true +groupName=image.kubeswift.io
kernel/v1alpha1
+kubebuilder:object:generate=true +groupName=kernel.kubeswift.io
+kubebuilder:object:generate=true +groupName=kernel.kubeswift.io
migration/v1alpha1
+kubebuilder:object:generate=true +groupName=migration.kubeswift.io
+kubebuilder:object:generate=true +groupName=migration.kubeswift.io
sandbox/v1alpha1
+kubebuilder:object:generate=true +groupName=sandbox.kubeswift.io
+kubebuilder:object:generate=true +groupName=sandbox.kubeswift.io
seed/v1alpha1
+kubebuilder:object:generate=true +groupName=seed.kubeswift.io
+kubebuilder:object:generate=true +groupName=seed.kubeswift.io
shared
Package shared holds common types for KubeSwift API.
Package shared holds common types for KubeSwift API.
snapshot/v1alpha1
+kubebuilder:object:generate=true +groupName=snapshot.kubeswift.io
+kubebuilder:object:generate=true +groupName=snapshot.kubeswift.io
swift/v1alpha1
+kubebuilder:object:generate=true +groupName=swift.kubeswift.io
+kubebuilder:object:generate=true +groupName=swift.kubeswift.io
cmd
gpu-discovery command
kubeswift-dra-driver command
kubeswift-dra-driver is KubeSwift's REFERENCE DRA driver for VM GPU passthrough.
kubeswift-dra-driver is KubeSwift's REFERENCE DRA driver for VM GPU passthrough.
kubeswift-gateway command
Command kubeswift-gateway is the browser-facing Connect hub for the KubeSwift UI.
Command kubeswift-gateway is the browser-facing Connect hub for the KubeSwift UI.
kubeswift-guest-agent command
Command kubeswift-guest-agent is a tiny in-guest agent that regenerates a cloneFromSnapshot clone's identity (machine-id / SSH host keys / hostname / MAC) and renews its DHCP lease IN PLACE — with no reboot — over a host-only vsock channel.
Command kubeswift-guest-agent is a tiny in-guest agent that regenerates a cloneFromSnapshot clone's identity (machine-id / SSH host keys / hostname / MAC) and renews its DHCP lease IN PLACE — with no reboot — over a host-only vsock channel.
sandbox-materialize command
sandbox-materialize is the SwiftSandbox rootfs init container.
sandbox-materialize is the SwiftSandbox rootfs init container.
snapshot-oras command
snapshot-oras — the OCI-registry (ORAS) uploader/downloader for KubeSwift SwiftSnapshot/SwiftRestore (Snapshot "oci" backend).
snapshot-oras — the OCI-registry (ORAS) uploader/downloader for KubeSwift SwiftSnapshot/SwiftRestore (Snapshot "oci" backend).
snapshot-s3 command
snapshot-s3 — the Tier C (object-storage export) uploader/downloader for KubeSwift SwiftSnapshot/SwiftRestore (Snapshot Phase 3).
snapshot-s3 — the Tier C (object-storage export) uploader/downloader for KubeSwift SwiftSnapshot/SwiftRestore (Snapshot Phase 3).
snapshot-stager command
swiftctl command
gen
internal
actions
Package actions implements the shared SwiftGuest lifecycle primitives — start, stop, migrate — used by BOTH swiftctl and the kubeswift-gateway.
Package actions implements the shared SwiftGuest lifecycle primitives — start, stop, migrate — used by BOTH swiftctl and the kubeswift-gateway.
cli
controller/migrationcert
Package migrationcert provisions the per-node TLS identities used by the Phase 3c live-migration mTLS transport (stunnel sidecar).
Package migrationcert provisions the per-node TLS identities used by the Phase 3c live-migration mTLS transport (stunnel sidecar).
controller/swiftdrain
Package swiftdrain implements the Phase 4 drain controller: the "controller creates" half of the webhook-marks / controller-creates / PDB-guarantees architecture (design doc §3).
Package swiftdrain implements the Phase 4 drain controller: the "controller creates" half of the webhook-marks / controller-creates / PDB-guarantees architecture (design doc §3).
controller/swiftguest
Cold / suspended-state migration (P4) — the import half.
Cold / suspended-state migration (P4) — the import half.
controller/swiftmigration
Package swiftmigration reconciles SwiftMigration resources for Phase 1 of live migration: offline migration via direct PVC reuse.
Package swiftmigration reconciles SwiftMigration resources for Phase 1 of live migration: offline migration via direct PVC reuse.
controller/swiftrestore
Package swiftrestore reconciles SwiftRestore resources.
Package swiftrestore reconciles SwiftRestore resources.
controller/swiftsnapshot
Cold / suspended-state migration (P4) — the disk half of an includeDisk oci snapshot.
Cold / suspended-state migration (P4) — the disk half of an includeDisk oci snapshot.
controller/swiftsnapshotschedule
Package swiftsnapshotschedule reconciles SwiftSnapshotSchedule resources: it creates a SwiftSnapshot each time the cron schedule fires (Phase 6).
Package swiftsnapshotschedule reconciles SwiftSnapshotSchedule resources: it creates a SwiftSnapshot each time the cron schedule fires (Phase 6).
gateway
Package gateway implements the kubeswift-gateway: the browser-facing Connect hub that fronts the KubeSwift operator across a fleet of member clusters.
Package gateway implements the kubeswift-gateway: the browser-facing Connect hub that fronts the KubeSwift operator across a fleet of member clusters.
gpualloc
Package gpualloc defines the pluggable GPU allocation backend seam for KubeSwift.
Package gpualloc defines the pluggable GPU allocation backend seam for KubeSwift.
guestagent
Package guestagent defines the host<->guest streaming wire protocol shared by the in-guest agent (cmd/kubeswift-guest-agent) and swiftctl for SwiftSandbox `exec` (streaming) and, later, interactive `attach`.
Package guestagent defines the host<->guest streaming wire protocol shared by the in-guest agent (cmd/kubeswift-guest-agent) and swiftctl for SwiftSandbox `exec` (streaming) and, later, interactive `attach`.
imageref
Package imageref centralises the lookup that both the SwiftImage and SwiftGuest controllers need: "give me the SwiftGuests in this namespace that reference this SwiftImage".
Package imageref centralises the lookup that both the SwiftImage and SwiftGuest controllers need: "give me the SwiftGuests in this namespace that reference this SwiftImage".
migrationsidecar
Package migrationsidecar is the single source of truth for the Phase 3c live-migration mTLS stunnel sidecar contract: the image, container name, mount paths, env keys, role values, and the controller<->sidecar annotation keys.
Package migrationsidecar is the single source of truth for the Phase 3c live-migration mTLS stunnel sidecar contract: the image, container name, mount paths, env keys, role values, and the controller<->sidecar annotation keys.
oci
Package oci holds the KubeSwift golden-image (P3) OCI transfer core: the sparse, zero-skipping, content-addressed disk chunking used by both the in-cluster snapshot-oras transfer Job and the client-side `swiftctl image publish` command.
Package oci holds the KubeSwift golden-image (P3) OCI transfer core: the sparse, zero-skipping, content-addressed disk chunking used by both the in-cluster snapshot-oras transfer Job and the client-side `swiftctl image publish` command.
sandbox/materialize
Package materialize turns an OCI image into a node-local VM root filesystem for a SwiftSandbox (mode-3 boot): it pulls the image by digest, flattens its layers (whiteouts applied), and produces either a read-only ext4 (block, the default) or an unpacked tree (virtio-fs).
Package materialize turns an OCI image into a node-local VM root filesystem for a SwiftSandbox (mode-3 boot): it pulls the image by digest, flattens its layers (whiteouts applied), and produces either a read-only ext4 (block, the default) or an unpacked tree (virtio-fs).
snapshot/clonecommon
Package clonecommon holds the backend-mechanism primitives shared by the snapshot clone/restore paths — the s3 download Job, the node-local cache layout, the per-clone MAC computation, and the runtime-dir prefix.
Package clonecommon holds the backend-mechanism primitives shared by the snapshot clone/restore paths — the s3 download Job, the node-local cache layout, the per-clone MAC computation, and the runtime-dir prefix.
snapshot/configjson
Package configjson reads and minimally patches Cloud Hypervisor's snapshot config.json before a restore-receive launch.
Package configjson reads and minimally patches Cloud Hypervisor's snapshot config.json before a restore-receive launch.
webhook/eviction
Package eviction is the Phase 4 drain-integration eviction webhook.
Package eviction is the Phase 4 drain-integration eviction webhook.
webhook/swiftmigration
Package swiftmigration contains the admission webhook validator for SwiftMigration.
Package swiftmigration contains the admission webhook validator for SwiftMigration.
webhook/swiftrestore
Package swiftrestore contains the admission webhook validator for SwiftRestore.
Package swiftrestore contains the admission webhook validator for SwiftRestore.
webhook/swiftsandbox
Package swiftsandbox holds the SwiftSandbox admission validator.
Package swiftsandbox holds the SwiftSandbox admission validator.
webhook/swiftsnapshot
Package swiftsnapshot contains the admission webhook validator for SwiftSnapshot.
Package swiftsnapshot contains the admission webhook validator for SwiftSnapshot.
webhook/swiftsnapshotschedule
Package swiftsnapshotschedule contains the admission webhook validator for SwiftSnapshotSchedule (Phase 6).
Package swiftsnapshotschedule contains the admission webhook validator for SwiftSnapshotSchedule (Phase 6).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL