Skip to content

Creating virtual machines

The platform supports VMs via kube-virt.

This is the point where we introduce features that make your Docker-Compose file no longer work with regular compose.

VMs are declared using the x-ctf-vms key.

YAML
x-ctf-vms:
    main:
      memory: 256Mi
      cpu_cores: 1
      disks:
        - image: quay.io/kubevirt/cirros-container-disk-demo
        - cloud_init_user_data_base64: IyEvYmluL3NoCmVjaG8gJ3ByaW50ZWQgZnJvbSBjbG91ZC1pbml0IHVzZXJkYXRhJwo=
      ports: # This re-uses the compose ports syntax
        - name: ssh
          target: 22
          protocol: tcp
          app_protocol: ssh
          x-username: cirros
          x-password: gocubsgo
      network_policy: # This re-uses the regular service network policy definition
          outgoing:
              rules:
                  - other_party: ClusterDNS # One of Challenge, ClusterDNS, World
                    ports: # Optional
                      - port: 53
                        protocol:
                          - UDP
                          - TCP

Disk support is like in Kube-Virt: You can use disk images or base64-encoded cloud init data.

A disk image should contain exactly one .qcow2 or .img file in /disk/. For example:

sh
cat << END > Dockerfile
FROM scratch
ADD --chown=107:107 my-chal.qcow2 /disk/
END

docker build -t my-chal:latest .

Imprint