Published on 2024-08-28
Categories:
tech
Tags:
selfhosting
virtualization
On my previous post, I mentioned migrating my server's VM platform to Proxmox. Here I'm describing how I got cloud init templates to quickly provision Linux Ubuntu VMs without requiring to go through an GUI installation process.
According to cloud-init.io, Cloud init is:
Cloud images are operating system templates and every instance starts out as an identical clone of every other instance. It is the user data that gives every cloud instance its personality and cloud-init is the tool that applies user data to your instances automatically.
Okay…
Maybe if I explain how I create a VM from a cloud-init image:
No lengthy installation from ISO, no additional OS specific GUI. All cloud-init capable OS are configured the same way.
TechnoTim has a really good YT video and blog post describing the initial cloud-init template creation for Ubuntu cloud image and Proxmox.
This is a good starting point for my own needs, and here is what I did in addition to the instructions described in the blog post.
Data logical drives are usually local
and local-lvm
, mines are files
and vm
.
Right before the qm template
command.
I never log as root. Always as a specific user, my-user
in this case.
|
|
Since I never set a password on these servers, I need to connect using ssh keys.
|
|
The qemu-agent allows to get more detailed information about the VM, like IP address, OS, and also allows better control over it’s running state.
Proxmox does not support adding packages from their UI, but since this is a standard cloud-init “protocol”, we can override some of the cloud-init configuration files to achieve that.
Since Proxmox use meta
, user
, network
cloud init files, and we can’t change these without breaking the UI, this leaves us the vendor configuration to override.
Here /pvepool/files
matches the files
logical storage defined in Proxmox.
|
|
Since I prefer CLI as it’s more reproducible, I captured the commands I used to provision my VMs.
The same operations can be done in the Proxmox UI though.
|
|
|
|
The drive created is too small, extend it based on needs
|
|
In my setup, I have vlan, which are separate vmbr0.<vlan> network interface.
|
|
|
|
For comments, use email or Mastodon
Don't forget to subscribe to my RSS feed!