Home Deploy Proxmox servers using Cloud Init
Post
Cancel

Deploy Proxmox servers using Cloud Init

Proxmox VM Templates using Cloud-Init

Using cloud images, which are essentially light weight, certified images compared to normal iso’s in tandam with cloud init making it really fast to spin up a virtual machine. Cloud images have cloud init preinstalled and can accept cloud configuration right out of the box. Proxmox can also leverage cloud init out of the box, combining both of these would be perfect, small, efficient, optimized clone template to provision machines with your ssh keys and network settings

The following are the step i took to create these templates using cloud init. We can also automate the whole things using a bash.

Firstly, select the ubuntu cloud image that we want to get started with. Browse the available images from the Ubuntu Images

We can download the image directly on the proxmox server, which is what i did, or we can download it and upload it to the server as well.

1
wget https://cloud-images.ubuntu.com/noble/current/noble-server-cloudimg-amd64.img

Create a new virtual machine

1
qm create 9000 --memory 2048 --core 2 --name ubuntu-cloud --net0 virtio,bridge=vmbr0

Import the downloaded Ubuntu disk to local storage (Change local to the storage of your choice)

1
qm disk import 9000 noble-server-cloudimg-amd64.img local

Attach the new disk to the vm as a scsi drive on the scsi controller (Change local to the storage of your choice)

1
qm set 9000 --scsihw virtio-scsi-pci --scsi0 local:9000/vm-9000-disk-0.raw

Add cloud init drive

1
qm set 9000 --ide2 local:cloudinit

Make the cloud init drive bootable and restrict BIOS to boot from disk only

1
qm set 9000 --boot c --bootdisk scsi0

Add serial console this is useful for login and verifying networking of the server

1
qm set 9000 --serial0 socket --vga serial0

At this point, we should see a virtual machine on the proxmox webpage. Navigating to the machine’s cloud init option, configure the following

  • username
  • password
  • ssh keys
  • set networking to DHCP or Static (Ip as default is none)

You can also configure the hardware options in the settings.

This configuration will ensure that all the machines cloned from this template will have the same login information and ssh keys making it easier for us

DO NOT START THE VIRTUAL MACHINE AT ANY POINT

If you start the virtual machine, it will set the PUID (machine id) of the machine and we will not be able to clone any machines further without having issues.

convert to template from portal or CLI

1
qm template 9000

Clone the template

1
qm clone 9000 135 --name test-001 --full
This post is licensed under CC BY 4.0 by the author.