[How to] Run Flatcar Container Linux on Proxmox

ddt3

Member
Feb 9, 2022
6
0
6
54
I started using Flatcar Container Linux to run my docker containers on Proxmox sometime ago. At some point I realized that I wanted a more structured approach to creating a flatcar vm (read: more automated). So I started creating some scripts that made that possible.

Next to that I created some Butane (yaml) snippets that I can include in other Butane files (e.g. add my ssh keys to all flatcar vms at ignition, add docker-compose, etc.).

I put those scripts and Butane (yaml) files here:
https://github.com/ddt3/proxmox-flatcar

Excerpt from the README:
-----

Overview of the process steps​

The following steps need to be performed

  1. Create a Butane (yaml) file for a new flatcar vm
  2. Run create_vm.sh
    It will automatically:
    1. Convert Butane file(s) to ignition files
    2. Transfer the "start" ignition file to proxmox
    3. Create a VM using a flatcar image
    4. Add the ignition file to the VM
    5. Start the VM
-----
More detailed information on github.

Hope this is useful to others too.

Cheers,

Dries
 
Last edited:
I have changed the scripts a bit, to make it more generic (and still working on it).

I am also trying to get rid of the need for a webserver (by merging local ignition files) but at the moment it is not possible to include multiple local files in a butane yaml (raised that as a butane issue for that).

Ideas for change that I have:
  • Remove need for webserver
  • If still using a webserver: upload of ign files to webserver
    I run my scripts on the webserver, so at this moment I have no need for upload " to the webserver
  • Put all config items in a config file
For now, these scrips serve my purpose. I would make it more generic because I think it is fun to do so.
 
Hi ddt3,

I noticed in your proxmox-flatcar repo that you're using a webserver to serve the Ignition files. I have two questions about your setup:

1. Have you explored attaching the Ignition file directly as an ISO to the VM (similar to cloud-init)? This would eliminate the need for running a separate webserver, which you mentioned wanting to remove in your forum post.

2. Are you using the standard Flatcar QEMU image from their website, or a different image? Because there is an upcomming alpha proxmox image for flatcar.

Thanks for sharing your work!
 
Hi ddt3,

I noticed in your proxmox-flatcar repo that you're using a webserver to serve the Ignition files. I have two questions about your setup:

1. Have you explored attaching the Ignition file directly as an ISO to the VM (similar to cloud-init)? This would eliminate the need for running a separate webserver, which you mentioned wanting to remove in your forum post.

2. Are you using the standard Flatcar QEMU image from their website, or a different image? Because there is an upcomming alpha proxmox image for flatcar.

Thanks for sharing your work!
Hello @janlauber,

I already add a local ignition file by placing it in a snippets folder:
Code:
qm set 123: -args -fw_cfg name=opt/org.flatcar-linux/config,file=/mnt/pve/NFS-USB/snippets/grav-fc.ign
so a web server is not a necessity for ignition file use.

However, for including other igntion files into my "main ignition file" a webserver is necessary, as local merge does not allow inclusion of multiple files. I have tried this with ignition files for coreos and flatcar, this appears to be limitation of Butane: Butane issue submitted

I am not sure what you mean by "attaching the ignition file directly as an ISO", is it a better way than what is described above?

2. I am indeed using the standard Flacar QEMU image:
wget https://stable.release.flatcar-linux.net/amd64-usr/current/flatcar_production_qemu_image.img
I was not aware of a flatcar proxmox image but I because of your remark I found this, need to look into that to understand what it actually means.
 
Hello @janlauber,

I already add a local ignition file by placing it in a snippets folder:
Code:
qm set 123: -args -fw_cfg name=opt/org.flatcar-linux/config,file=/mnt/pve/NFS-USB/snippets/grav-fc.ign
so a web server is not a necessity for ignition file use.

However, for including other igntion files into my "main ignition file" a webserver is necessary, as local merge does not allow inclusion of multiple files. I have tried this with ignition files for coreos and flatcar, this appears to be limitation of Butane: Butane issue submitted

I am not sure what you mean by "attaching the ignition file directly as an ISO", is it a better way than what is described above?

2. I am indeed using the standard Flacar QEMU image:
wget https://stable.release.flatcar-linux.net/amd64-usr/current/flatcar_production_qemu_image.img
I was not aware of a flatcar proxmox image but I because of your remark I found this, need to look into that to understand what it actually means.

Hi @ddt3,

Thank you for your detailed response!

I’ve also managed to get the ignition file working by placing it in the snippets folder, but I’m running into a similar challenge: the lack of automation. As far as I know, there’s currently no straightforward way to push or upload files to the snippets folder via the Proxmox API (e.g., this forum thread).

To address this limitation, I’ve been considering an alternative approach. My idea is to package the ignition file into an ISO and use the -fw_cfg option to point QEMU to look for the ignition file within the ISO. However, I haven’t been able to get this solution working just yet. Have you explored something similar, or do you have any suggestions on how to make this approach work?

I’m also intrigued by your mention of including additional ignition files via a web server due to Butane’s limitations. That’s a helpful insight, as I hadn’t considered such a scenario before.
 
Hi @ddt3,

Thank you for your detailed response!

I’ve also managed to get the ignition file working by placing it in the snippets folder, but I’m running into a similar challenge: the lack of automation. As far as I
I think it would be best to have a look at the proxmox_create_vm.sh in my git repository. There I actually use wget to get the ignition file from the webserver to the snippet folder. But I could also use scp (or ssh) because all my desktop systems are linux systems too. I do not use the API for automation. i just use ssh to run commands on the proxmox server.


So my scripts actually already automate the whole thing. Once a proper ignition file exists, running the bash scripts will cause a new VM running flatcar with the ignition files applied.

I’m also intrigued by your mention of including additional ignition files via a web server due to Butane’s limitations. That’s a helpful insight, as I hadn’t considered such a scenario before.
I have "standard" ignition files for things like " add the proper ssh key", add docker-compose to flatcar, add an NFS mount, really helpful!