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

Proxmox support #1040

Closed
lukasmrtvy opened this issue May 24, 2023 · 9 comments
Closed

Proxmox support #1040

lukasmrtvy opened this issue May 24, 2023 · 9 comments
Labels
kind/feature A feature request platform/new-platform linked to new platform addition (cloud provider, image type, architecture, etc.)

Comments

@lukasmrtvy
Copy link

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

@gabriel-samfira
Copy link
Member

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?

@mritalian
Copy link

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?

@abuisine
Copy link

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: coreos/afterburn#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 / ....)

@tormath1 tormath1 added the platform/new-platform linked to new platform addition (cloud provider, image type, architecture, etc.) label Apr 3, 2024
@mcbenjemaa
Copy link

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
ionos-cloud/cluster-api-provider-proxmox#302

@mritalian
Copy link

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}"
....
}

@mcbenjemaa
Copy link

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

@mritalian
Copy link

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

@tormath1
Copy link
Contributor

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: flatcar/flatcar-website#337

@github-project-automation github-project-automation bot moved this from ✅ Testing / in Review to Implemented in Flatcar tactical, release planning, and roadmap Nov 13, 2024
@abuisine
Copy link

Thanks a lot :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature A feature request platform/new-platform linked to new platform addition (cloud provider, image type, architecture, etc.)
Projects
Development

No branches or pull requests

7 participants