Tiernan's Comms Closet

Geek, Programmer, Photographer, network egineer…

Currently Viewing Posts Tagged proxmox

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 ""; };'

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.

Day 59 of #100daysofhomelab – Proxmox Updates, LTT Hacked, New Framework Laptops

Day 59 of and Proxmox released 7.4 of their Virtual Environment. I have not upgraded any of my machines to it, just yet, but that’s the plan for the weekend. Other than that, some links:

Day 16 of #100daysofhomelab

day 16 of #100daysofhomelab, and my test from yesterday paid off!

droped from 10 to less than 4gb of RAM used on one of my proxmox boxes by moving the storage from local ZFS to NFS… Mind you, only seems to have made a difference on this box…

On a more different note, this blog is now on the fediverse. You can subscribe by searching for @tiernano on your fediverse client. It is done with the help of pfefferle/wordpress-activitypub: ActivityPub for WordPress (github.com).

Day 16 of #100daysofhomelab

Day 16 of #100daysofhomelab and not much going on. Busy with work. I am running a test though. I seen the following tweet a few days back:


Given some of my smaller boxes are running 90%+ memory usage, i have decided to move the VMs from my NUC to my QNAP storage box. Its going to take a while to move them over, but we see what RAM usage is like after.

Just for reference, this is the before:

Day 2 of #100daysofhomelab

Day 2 of #100daysofhomelab and more messing with Kubernetes… So far, I have built, torn down, rebuilt and torn down a second time… and now building for a third time! Techno Tims Ansible scripts for the Win! A couple of notes for today:

  • the script uses K3s version 1.24.8-k3s1. at some stage yesterday I tried changing this to 1.26.0-k3s1, the latest version from the K3s GitHub page… This was a bad idea. Rancher does not like this, and, well, I don’t know what I am doing, so I want to see what Rancher does…
  • ideally, you would have multiple master nodes, but, me being the lazy git that I am, only set up 1… but it does look like it could be changeable later on…
  • I have a total of 6 VMs running my K3S cluster: 3 are 4 Cores with 8GB RAM running on GodBoxV2, which is now running Proxmox. The other 3 are each running on my HP Micro Server, the Quad 2.5Gb Celeron Box and an 8th Gen Intel NUC… each is given 2 cores and 4GB RAM. That gives me a total of (roughly) 18 cores and 36GB RAM. Each VM has around 50 GB of storage and using Longhorn, I have around 250GB of space (master does not seem to contribute space). Replicas are set to 3, so not quite a full 250GB.
  • Why Kubernetes? Well, I have 2 VMs currently running my fleet of docker containers. I have lost count of how many i actually have. So, my plan is to use Kubernetes to move all them from those single docker boxes, and have them more distributed and more HA. This will allow me to move stuff around easier, or at least i think it will… At the very least, i get to play with new tech! 🙂

More work on the cluster is required. This blog is hosted in-house on one of the docker instances… Hopefully, at some stage, it will be moved to the K3s cluster! That would be the first major move!