Tiernan's Comms Closet

Geek, Programmer, Photographer, network egineer…

Monthly Archives April 2024

Building Cloud Images for Proxmox

I needed to create a few Ubuntu VMs for a Kubernetes cluster for testing, and wanted to make this as easy as possible using Proxmox and some (minor) automation… Here is what I have done:</span>

First, Download the base image:

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

Then tweak the image… I’m using my apt-cacher-ng proxy here so I set the proxy for all VMs. you can remove it or tweak it as required. If you want to remove it, remove the append-line option. I am also installing qemu-guest-agent here. You can add extra items at this point if you want.

sudo virt-customize -a jammy-server-cloudimg-amd64.img --install qemu-guest-agent --append-line '/etc/apt/apt.conf.d/00proxy:Acquire::http { Proxy "http://10.244.71.182:3142"; };'

Sysprep the image

resets it to the default stage. If you don’t do this, and clone the machine 2 or 3 times, they all get the same machine ID and IP address… [Note: This is not fully working for me… See below where I make changes to machine ID… ]

sudo virt-sysprep -a jammy-server-cloudimg-amd64.img

Create the template. I used ID 9000 and set a name. You can change this. Also, I have mind tagged with VLAN 72 (my Kubernetes VLAN). Change or remove as required. Also, I set the disk size to add 50Gb. Any mention of godboxv2-tank should be changed to your storage name…

sudo qm create 9000 --name "ubuntu-2204-cloudinit-template" --memory 4096 --cores 2 --net0 virtio,bridge=vmbr0,tag=72

sudo qm importdisk 9000 jammy-server-cloudimg-amd64.img godboxv2-tank

sudo qm set 9000 --scsihw virtio-scsi-pci --scsi0 godboxv2-tank:vm-9000-disk-0

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

sudo qm disk resize 9000 scsi0 +50G

sudo qm set 9000 --ide2 godboxv2-tank:cloudinit

sudo qm set 9000 --serial0 socket --vga serial0

sudo qm set 9000 --agent enabled=1

sudo qm template 9000

Clone the VM into a new VM.

sudo qm clone 9000 2001 --name k8s-01

sudo qm set 2001 --sshkey godboxv3.pub

sudo qm set 2001 --memory 4096

sudo qm set 2001 --ciuser tiernano

sudo qm set 2001 --ipconfig0 ip=dhcp

Change tiernano and godboxv3.pub to your settings. change names and memory as required.

As mentioned above, I am still having the issue with IPs being shared… to fix this, log into the boxes and run the following:

echo -n > /etc/machine-id

rm /var/lib/dbus/machine-id

ln -s /etc/machine-id /var/lib/dbus/machine-id

and then reboot. The problem should now be solved.

Some network Upgrades going on

I am in the middle of a fairly large network upgrade for the CloudShed. I have bought 2 Ubiquiti Unifi Hi-Capacity Aggregration Switchs, a 24 Port SWitch Pro POE, a Switch Enterprise 8 PoE, a couple of U7 Pro Access Points and a U6 In-wall.

The 2 Aggregation Switches have 4 25Gb ports on them, along with 28 10Gb ports. 2 of the 25Gbs are going to be linked between the house and the CloudShed. The U6 InWall is going into the office, the 2 U7 Pros are in the house already, powered by the Switch Enterprise 8 Poe (2.5Gb enternet on that!) and the 24 port Poe Switch will replace my older 16 port one, which does not have 10Gb ethernet. More stuff on this coming when I get more time to install it all.