blog

12021-05-13

SEAN K.H. LIAO

kubevirt

kubevirt is a kubernetes controller to manage libvirt virtual machines as CRDs. It is tightly integreated with its containerized-data-importer subproject for importing VMs into PVCs.

tested on v0.40.0.

compatibility

The 2 big things it needs: network and storage. Networking should work fine, except when you use cilium without kube-proxy, then you run into issues where services are not reachable. This manifests itself most visibly as DNS not being available from inside the VM.

On storage, I was using longhorn (who really should fix thier docs to make it more obvious you're looking at an old version) and ran into a problem copying between PVCs, tldr, mounting as readonly is not yet supported. Oh well, host the image somewhere and download it every time I guess.

using

kubectl virt console myvm never actually worked for me, vnc was much more reliable.

On the images themselves, using cloud-init is probably the safest option to get started, such as Arch Linux VM images (choose cloudimg). And if you never used it: the main entrypoint can be a script or a config file, identified with #cloud-init in place of a shebang.

On making the images, I'm partial to mkosi since creating the image doesn't actually require spinning up a vm.