diff options
author | jbpratt <jbpratt78@gmail.com> | 2021-12-20 17:50:05 -0600 |
---|---|---|
committer | jbpratt <jbpratt78@gmail.com> | 2021-12-21 05:52:16 -0600 |
commit | e96e5ddd1fd3fa7836ffc7fab5708ed78f1fda5d (patch) | |
tree | cb42bf8d5064695ef5a2f47d8f548666b8875641 /nixos/modules/virtualisation/kubevirt.nix | |
parent | ec75185ee2b0e9782842597d8cc06f5ed3b5aeb2 (diff) | |
download | nixpkgs-e96e5ddd1fd3fa7836ffc7fab5708ed78f1fda5d.tar nixpkgs-e96e5ddd1fd3fa7836ffc7fab5708ed78f1fda5d.tar.gz nixpkgs-e96e5ddd1fd3fa7836ffc7fab5708ed78f1fda5d.tar.bz2 nixpkgs-e96e5ddd1fd3fa7836ffc7fab5708ed78f1fda5d.tar.lz nixpkgs-e96e5ddd1fd3fa7836ffc7fab5708ed78f1fda5d.tar.xz nixpkgs-e96e5ddd1fd3fa7836ffc7fab5708ed78f1fda5d.tar.zst nixpkgs-e96e5ddd1fd3fa7836ffc7fab5708ed78f1fda5d.zip |
virtualisation: implement kubevirt config
KubeVirt[1] allows for VMs to be run and managed as pods inside of Kubernetes clusters. Information about the guests can be exposed through qemu-guest-agent[2] as well as startup scripts can be injected through cloud-init[3]. This config has been duplicated and modified from the `cloudstack` config/script. To test this out, deploy KubeVirt locally with KinD[4], build the disk image, then package it into a container image (or upload to CDI[5]) and provision a VirtualMachine. [1]: https://kubevirt.io/user-guide/ [2]: https://kubevirt.io/user-guide/virtual_machines/guest_agent_information/ [3]: https://kubevirt.io/user-guide/virtual_machines/startup_scripts/#cloud-init-examples [4]: https://kubevirt.io/quickstart_kind/ [5]: https://kubevirt.io/user-guide/operations/containerized_data_importer/#containerized-data-importer Signed-off-by: jbpratt <jbpratt78@gmail.com>
Diffstat (limited to 'nixos/modules/virtualisation/kubevirt.nix')
-rw-r--r-- | nixos/modules/virtualisation/kubevirt.nix | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/nixos/modules/virtualisation/kubevirt.nix b/nixos/modules/virtualisation/kubevirt.nix new file mode 100644 index 00000000000..408822b6af0 --- /dev/null +++ b/nixos/modules/virtualisation/kubevirt.nix @@ -0,0 +1,30 @@ +{ config, lib, pkgs, ... }: + +{ + imports = [ + ../profiles/qemu-guest.nix + ]; + + config = { + fileSystems."/" = { + device = "/dev/disk/by-label/nixos"; + fsType = "ext4"; + autoResize = true; + }; + + boot.growPartition = true; + boot.kernelParams = [ "console=ttyS0" ]; + boot.loader.grub.device = "/dev/vda"; + boot.loader.timeout = 0; + + services.qemuGuest.enable = true; + services.openssh.enable = true; + services.cloud-init.enable = true; + systemd.services."serial-getty@ttyS0".enable = true; + + system.build.kubevirtImage = import ../../lib/make-disk-image.nix { + inherit lib config pkgs; + format = "qcow2"; + }; + }; +} |