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

docs: proxmoxve: add promoxve install doc #337

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions content/docs/latest/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ purposes. You can use any of the following options.
* [Vagrant][vagrant] (community support)
* [Hyper-V][hyper-v] (community support)
* [KubeVirt][kubevirt] (community support)
* [Proxmox VE][proxmoxve] (community support)

#### Bare Metal
You can install Flatcar on bare metal machines in different ways: using ISO
Expand Down Expand Up @@ -199,6 +200,7 @@ Flatcar tutorial to deep dive into some Flatcar fundamental concepts.
[vagrant]: installing/vms/vagrant
[hyper-v]: installing/vms/hyper-v
[kubevirt]: installing/vms/kubevirt
[proxmoxve]: installing/vms/proxmoxve
[vmware]: installing/cloud/vmware
[cluster-architectures]: setup/clusters/architectures
[update-strategies]: setup/releases/update-strategies
Expand Down
115 changes: 115 additions & 0 deletions content/docs/latest/installing/vms/proxmoxve.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
---
title: Running Flatcar Container Linux on Proxmox VE
linktitle: Running on Proxmox VE
weight: 30
---

_While we always welcome community contributions and fixes, please note that Proxmox VE is not an officially supported platform at this time because the release tests don't run for it. (See the [platform overview](/#installing-flatcar).)_

These instructions will walk you through running Flatcar Container Linux on Proxmox VE.

## Choose a channel

Flatcar Container Linux is designed to be updated automatically with different schedules per channel. You can [disable this feature][update-strategies], although we don't recommend it. Read the [release notes][release-notes] for specific features and bug fixes.

Promox VE OEM images are created for both amd64 and arm64 and come in qcow2 compressed format.

How to download a Promox VE qcow2 image file:

```bash
# THIS IS A DEVELOPMENT BUILD
# TODO: update link with an alpha build
wget http://bincache.flatcar-linux.net/images/amd64/9999.0.102+kai-proxmox-support/flatcar_production_proxmoxve_image.img.bz2 | bzip2 -d > flatcar_production_proxmoxve_image.img
Copy link
Collaborator

Choose a reason for hiding this comment

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

I will check to directly provide uncompressed image. The benefit is not that important:

$ du --si flatcar_production_proxmoxve_image.img
548M	flatcar_production_proxmoxve_image.img
$ du --si flatcar_production_proxmoxve_image.img.bz2
546M	flatcar_production_proxmoxve_image.img.bz2

Choose a reason for hiding this comment

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

wget | bzip2 -d > … pipes the output from wget itself to bzip, not the downloaded file (that would be wget -O - ), replacing wget with curl would be better.

```

## Preparing the image

Promox VE graphical UI only supports ISO images, but the Flatcar image is in QCOW2 format.
tormath1 marked this conversation as resolved.
Show resolved Hide resolved
In order to create a VM with our image we'll need to use the command line. Open a shell on the hypervisor, download the image and convert it to RAW :

```bash
qemu-img convert -f qcow2 -O raw flatcar_production_proxmoxve_image.img flatcar_production_proxmoxve_image.bin

Choose a reason for hiding this comment

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

Converting the image is not required when you use the terminal. qm disk import can import the qcow2 file directly.

```

## Creating the VM

Because our image is not in ISO format we'll need to use the command-line to create the VM.

```bash
export VM_ID=123

# create the vm and import the image to it's disk
qm create $VM_ID

Choose a reason for hiding this comment

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

Should include a network interface and probably some CPU/RAM settings:

qm create $VM_ID --cores 2 --memory 4096 --net0 "virtio,bridge=vmbr0" --ipconfig0 "ip=dhcp"

qm disk import $VM_ID flatcar_production_proxmoxve_image.bin local
Copy link
Contributor

Choose a reason for hiding this comment

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

local-lvm supports disks, local seems to support only ISOs


# tell the vm to boot from the imported image
qm set $VM_ID --scsi0 local:$VM_ID/vm-$VM_ID-disk-0.raw

Choose a reason for hiding this comment

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

Proxmox 8.2 uses a different notation:
qm set $VM_ID --scsi0 local-lvm:vm-$VM_ID-disk-0

qm set $VM_ID --boot order=scsi0
```

## Configuring the VM with Openstack-style cloud-init config

Our VM can be booted as-is, however we might want to add a cloud-init configuration.
Copy link
Contributor

Choose a reason for hiding this comment

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

The VM I booted without config drive is not booting - as it stops at the initrd stage and drops into an emergency shell, because the coreos-metadata service fails.

Copy link

@fhemberger fhemberger Oct 25, 2024

Choose a reason for hiding this comment

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

Fixed by:

# Create the cloud-init CD-ROM drive which activates the cloud-init options for the VM.
qm set $VM_ID --ide2 local-lvm:cloudinit


Select the VM, then go to Hardware and click Add > CloudInit Drive. You can then edit the config from the CloudInit tab.

What is supported :

- Setting hostname (hostname is always $VM_ID)
- Writing SSH keys
- Writing network configuration

Copy link
Contributor

Choose a reason for hiding this comment

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

A small note should be added: if username and password is set, it will not work.

Choose a reason for hiding this comment

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

Rather a big note. I've been messing around with the settings a bit:

  • Setting username, password and SSH key via Proxmox-GUI, providing ignition.json only with "ignition" stanza: Doesn't work, Flatcar doesn't initialize.
  • Setting username, password and SSH key via Proxmox-GUI, setting same username (w/o pw/key) in ignition: User settings are not merged, no login posssible.
  • Setting only SSH key (leaving username/password), user core w/o SSH key in ignition.json: User settings are not merged, no login posssible.
  • Hostname is not VM name/ID, console still shows localhost, when no /etc/hostname is provided in ignition.json.

Not saying it should be supposed at this point, but this will defninitively be an issue people will run into. Best would be to point out to use ignition config only and not cloud init settings in the GUI.

## Configuring the VM using Ignition

> **Important note**: Ignition configuration uses the same `user-data` file than the cloud-init config. This means that you cannot use both Ignition config and regular cloud-init. When setting up an Ignition config, expect the cloud-init services to fail during boot (this is harmless).

Promox VE graphical interface does not support setting a custom user-data file. You'll need to use the command line to achieve this.

First of all we need to write the Ignition config as as snippet. Snippets are located at `/var/lib/vz/snippets` on the hypervisor. Write a file named `user-data` containing your Ignition config. Here is an example :

```bash
cat /var/lib/vz/snippets/user-data

{
"ignition": { "version": "3.0.0" },
"storage": {
"files": [{
"path": "/etc/someconfig",
"mode": 420,
"contents": { "source": "data:,example%20file%0A" }
}]
},
"passwd": {
"users": [
{
"name": "toto",
"passwordHash": "$6$fdcVz5Na2Kklqcuq$roqjSQpcqyAVNIK8BmeoD1Hypq28unTUuJkc8EAn1rnJ0eTsUuscEhtycmn8cJuyaWleqBJ37yxgxkcxC47H8.",
"sshAuthorizedKeys": [
"ssh-rsa your-public-ssh-key"
]
}
]
}
Copy link
Contributor

Choose a reason for hiding this comment

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

it s also worth to add a kernelArguments with autologin here, just to have a more friendly environment for testing this out.

Copy link
Contributor

Choose a reason for hiding this comment

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

also, the cloud-init config drive needs to be added in order for the snippet to work.

Copy link
Contributor

Choose a reason for hiding this comment

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

This worked for me with ignition:

export VM_ID=124

# create the vm and import the image to it's disk
qm create $VM_ID --cores 2 --memory 4096 --net0 "virtio,bridge=vmbr0" --ipconfig0 "ip=dhcp"
qm disk import $VM_ID flatcar_production_proxmoxve_image.bin local-lvm

# tell the vm to boot from the imported image
qm set $VM_ID --scsi0 local-lvm:vm-$VM_ID-disk-0
qm set $VM_ID --boot order=scsi0

qm set $VM_ID --ide2 local-lvm:cloudinit

qm set $VM_ID --cicustom "user=local:snippets/user-data"

qm start $VM_ID

}
```

The password hash was obtained by running `mkpasswd` :

```bash
echo "toto" | mkpasswd --method=SHA-512 --stdin
```

Finally, tell the VM to use this file as `user-data` :

```bash
qm set $VM_ID --cicustom "user=local:snippets/user-data"
```

## Using Flatcar Container Linux

Now that you have a machine booted it is time to play around. Check out the [Flatcar Container Linux Quickstart][quickstart] guide or dig into [more specific topics][doc-index].

[update-strategies]: ../../setup/releases/update-strategies
[release-notes]: https://flatcar-linux.org/releases
[quickstart]: ../
[doc-index]: ../../