Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

image: add kubevirt image build #1962

Merged
merged 1 commit into from
Apr 30, 2024
Merged

Conversation

ader1990
Copy link
Contributor

As Ignition supports KubeVirt, add a custom oem for it and also the required parts to be able to build an image in .qcow2 format and .gz compression.

Fixes: flatcar/Flatcar#1358

ci-automation/vms.sh Outdated Show resolved Hide resolved
@ader1990
Copy link
Contributor Author

Tested locally on my Kubevirt Environment and the image works as expected.

Workflow:

  1. Deply Kubernetes with CDI and KubeVirt (not the scope of this how to)
  2. Use virtctl to create a PVC from the image:
virtctl image-upload pvc flatcar-kubevirt-pvc --size=10Gi --image-path flatcar_production_kubevirt_image.qcow2
  1. Create KubeVirt VM
apiVersion: kubevirt.io/v1
kind: VirtualMachine
metadata:
  generation: 1
  labels:
    kubevirt.io/os: linux
  name: vm-flatcar
spec:
  running: true
  template:
    metadata:
      creationTimestamp: null
      labels:
        kubevirt.io/domain: vm-flatcar
    spec:
      architecture: amd64
      nodeSelector:
        kubernetes.io/arch: amd64
      domain:
        cpu:
          cores: 2
        devices:
          disks:
          - disk:
              bus: virtio
            name: disk0
          - cdrom:
              bus: sata
              readonly: true
            name: cloudinitdisk
        machine:
          type: q35
        resources:
          requests:
            memory: 1024M
      volumes:
      - name: disk0
        persistentVolumeClaim:
          claimName: flatcar-kubevirt-pvc
      - cloudInitConfigDrive:
          userData: |
            {"ignition":{"version":"3.3.0"},"kernelArguments":{"shouldExist":["flatcar.autologin"]},"passwd":{"users":[{"name":"core","passwordHash":"$6$sn3ZSJJJln5JkAZb$VDTKzLpCyjlEe7Kh0DKjOnEawkkOoi0tOKVbcCv0FIWSf3u9Y1p1I5YdJJ5L8uDmmMvO2CBlmJZNdxFuekjjE1"}]}}
        name: cloudinitdisk
  1. Connect to VM using core/foo password

Copy link

github-actions bot commented Apr 29, 2024

@ader1990 ader1990 self-assigned this Apr 29, 2024
@ader1990 ader1990 force-pushed the ader1990/add_kubevirt_image_support branch from 622bdcf to 79bc25a Compare April 29, 2024 10:31
@ader1990
Copy link
Contributor Author

@pothos thank you for the comments.

I have created the PR to enable hostname set using the metadata from the config drive:
flatcar/bootengine#95

@ader1990
Copy link
Contributor Author

I will also start a documentation PR with the discussion resume on how Ignition or coreos-cloudinit works and in what scenarios, plus the above examples / steps to run Flatcar with KubeVirt.

Copy link
Member

@pothos pothos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@ader1990 ader1990 marked this pull request as ready for review April 30, 2024 05:58
@ader1990
Copy link
Contributor Author

Tested locally on KubeVirt using Ignition and Bash userdata, and all works as expected.

As Ignition supports KubeVirt, add a custom oem for it and also the
required parts to be able to build an image in .qcow2 format that
is already using internal .qcow2 gzip compression.

Fixes: flatcar/Flatcar#1358

Signed-off-by: Adrian Vladu <avladu@cloudbasesolutions.com>
@ader1990 ader1990 merged commit d313533 into main Apr 30, 2024
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[RFE] Publish official Kubevirt images
2 participants