Skip to main content

Cloud-init

This page builds a Proxmox cloud-init template from an Ubuntu cloud image so you can clone Kubernetes nodes later. VM ID 9999 is the template for K3s (Terraform / Proxmox) and a convenient source for the CKS kubeadm lab, where you full-clone two VMs in the UI yourself (no Terraform).

Download a cloud image from https://cloud-images.ubuntu.com/. The commands below were tested with https://cloud-images.ubuntu.com/noble/current/noble-server-cloudimg-amd64.img.

Create the VM on the Proxmox host, import the disk, attach cloud-init, and grow the disk:

qm create 9999 --memory 8192 --core 2 --name ubuntu-cloud --net0 virtio,bridge=vmbr0
cd /var/lib/vz/template/iso/ # or to the location where the image was downloaded
qm importdisk 9999 <IMAGE NAME> <YOUR STORAGE HERE>
qm set 9999 --scsihw virtio-scsi-pci --scsi0 <YOUR STORAGE HERE>:9999/vm-9999-disk-0.raw
qm set 9999 --ide2 <YOUR STORAGE HERE>:cloudinit
qm set 9999 --boot c --bootdisk scsi0
qm set 9999 --serial0 socket --vga serial0
qm disk resize 9999 scsi0 64G

In the Proxmox UI, set User, Password, SSH public key, and IP Config to DHCP. Convert the VM to a template. New k3s nodes come from a full clone of that template, or from Terraform. CKS lab nodes are VMs you create yourself (typically full clones of the same template in the UI, not Terraform); see CKS kubeadm lab.