Flatcar icon indicating copy to clipboard operation
Flatcar copied to clipboard

Proxmox support

Open lukasmrtvy opened this issue 2 years ago • 7 comments

Proxmox does not support ignition, but one can probably trigger loading cloud-init from a static ignition file ( /var/lib/vz/snippets/ignition-run-cloud-init.json ). Passing ignition via -fw_cfg isn't solution, its just not possible for non root users, see https://forum.proxmox.com/threads/fedora-core-os-ignition-root-pam-api-tokens-restricted-from-using-qemu-args.108886/ for more info.

Trying this ( via root user in proxmox ):

qm create 9005 --name flatcar3510.2.1-qemu-template --memory 1024 --net0 virtio,bridge=vmbr0
qm importdisk 9005 flatcar_production_qemu_image.img local-lvm
qm set 9005 --scsihw virtio-scsi-pci --scsi0 local-lvm:vm-9005-disk-0
qm set 9005 --ide2  local-lvm:cloudinit
qm set 9005 --boot c --bootdisk scsi0
qm set 9005 --serial0 socket --vga serial0
qm set 9005 --args '-fw_cfg name=opt/org.flatcar-linux/config,file="/var/lib/vz/snippets/ignition-run-cloud-init.json"'
qm template 9005


cat /var/lib/vz/snippets/ignition-run-cloud-init.json
{
  "ignition": { "version": "2.2.0" },
  "systemd": {
    "units": [{
      "name": "run-cloud-init.service",
      "enabled": true,
      "contents": "[Service]\nType=oneshot\nExecStartPre=mkdir /media/iso\nExecStartPre=mount /dev/sr0 /media/iso\nExecStart=/usr/bin/coreos-cloudinit -from-configdrive /media/iso\n\n[Install]\nWantedBy=default.target"
    }]
  }
}

, but the VM cloned from this template does not fetch cloud-init settings set directly on VM via WebUI.

Debug:

/usr/bin/coreos-cloudinit -from-configdrive /media/iso
2023/05/24 19:28:34 Checking availability of "cloud-drive"
2023/05/24 19:28:34 Fetching user-data from datasource of type "cloud-drive"
2023/05/24 19:28:34 Attempting to read from "/media/iso/openstack/latest/user_data"
2023/05/24 19:28:34 Fetching meta-data from datasource of type "cloud-drive"
2023/05/24 19:28:34 Attempting to read from "/media/iso/openstack/latest/meta_data.json"
2023/05/24 19:28:34 Merging cloud-config from meta-data and user-data
2023/05/24 19:28:34 Ensuring runtime unit file "etcd.service" is unmasked
2023/05/24 19:28:34 Ensuring runtime unit file "etcd2.service" is unmasked
2023/05/24 19:28:34 Ensuring runtime unit file "fleet.service" is unmasked
2023/05/24 19:28:34 Ensuring runtime unit file "locksmithd.service" is unmasked
ls /media/iso/
meta-data  network-config  user-data  vendor-data

Thanks

lukasmrtvy avatar May 24 '23 19:05 lukasmrtvy

Hi!

I'm looking at updating coreos-cloudinit in the following months (as time permits). As part of that I'll try to add more datasources, including the NoCloud data source which proxmox seems to use. It should then be able to detect the iso labeled cidata and apply that cloud config.

Would that help?

gabriel-samfira avatar May 25 '23 21:05 gabriel-samfira

Seems maybe the OP lost interest, but I'm about to dabble in proxmox. I'd love to be able to use flatcar in my tf deployments there. Is there anything I can do to help?

mritalian avatar Sep 13 '23 07:09 mritalian

Hi folks, we've been working on proxmoxve support for flatcar.

The work has been two folds :

  1. add proxmoxve cloudinit format support to afterburn
  2. create a proxmoxve compatible OEM partition

The work on afterburn is ok (dns, ssh-keys, ip configuration, ...), you can follow-up an eventual merge through the following PR: https://github.com/coreos/afterburn/pull/1023

The work on the OEM side of things consist of installing the modified afterburn, and then using typical OEM stuff to enable proxmoxve compatibility, we are building the stable versions on a regular basis: https://github.com/enix/flatcar-proxmoxve/releases

I must say we would prefer to have our work on afterburn merged, and avoid custom binary installation through the OEM partition ... hopefully it will happen at some point in the future. Then the flatcar project could build proxmoxve variants easily.

In the meantime, feel free to use our images or request other builds (beta / lts / ....)

abuisine avatar Jan 22 '24 13:01 abuisine

Hey,

Is there anything new? I tried injecting an ISO with the `user data' containing the ignition, but it didn't work.

I would appreciate any help in this case. I'm trying to add support for flat in our CAPI provider https://github.com/ionos-cloud/cluster-api-provider-proxmox/issues/302

mcbenjemaa avatar Oct 14 '24 13:10 mcbenjemaa

Pretty sure user data doesn't work in pmve like in esxi. The way I did it

resource "proxmox_virtual_environment_file" "ignition" {
	content_type = "snippets"
	datastore_id = local.datastore_id
	node_name    = local.node_name

	source_raw {
		data = module.ignition.rendered
		file_name = local.ignition_file_name
	}
}

...

resource "proxmox_virtual_environment_vm" "vm" {
....
	kvm_arguments = "-fw_cfg name=opt/org.flatcar-linux/config,file=/var/lib/vz/snippets/${local.ignition_file_name}"
....
}

mritalian avatar Oct 14 '24 16:10 mritalian

fw_cfg We couldn't use arguments only with root user.

mcbenjemaa avatar Oct 14 '24 17:10 mcbenjemaa

@mcbenjemaa yes indeed fw_cfg requires root. Don't know of any other workaround.

mritalian avatar Oct 14 '24 21:10 mritalian

Hello folks, the Proxmox support is now available on Alpha release: https://www.flatcar.org/releases#release-4152.0.0. Thanks everyone involved on the development and the testing of this feature. The documentation is available here: https://github.com/flatcar/flatcar-website/pull/337

tormath1 avatar Nov 13 '24 15:11 tormath1

Thanks a lot :)

abuisine avatar Nov 13 '24 17:11 abuisine