Ubuntu 22.04 Template with Cloud-Init

Creating a cloud-init template is relatively simple and straightforward to do. Essentially, you'll want to create your VM with base configurations, and then convert it to a template within Proxmox VE. Follow the steps below to create your own template with cloud-init.

Create your VM in Proxmox

image.png

OS Settings

image.png

System Settings

image.png

Disk Settings

image.png

CPU Settings

image.png

You can keep this at default settings, or change depending on what your intentions are for this template. I plan to use this specific template for Kubernetes nodes, so I'll be using minimal requirement specs

Memory Settings

image.png

Network Settings

image.png

Hardware Settings

image.png

Cloud-Init Settings

image.png

Establish a terminal connection to your Proxmox VE so you can configure Cloud-Init further

image.png

You'll now want to download the cloud image you'd like to use for the VM with wget. You can find Cloud Images at the Ubuntu Cloud website and select any version of flavor of linux you'd like. I'll be using the Ubuntu Minimal 22.04 LTS (Jammy) image:

image.png

Select the release you'd like to use, or scroll all the way down and select release/ for the most current. In this folder, find the amd64.image and copy the download link.

image.png

In your terminal window for Proxmox, run the command below:

wget https://cloud-images.ubuntu.com/minimal/releases/jammy/release/ubuntu-22.04-minimal-cloudimg-amd64.img

After downloading, run the ls command to view the file name:

image.png

Since I've already created templates before, I have some files already in there. The file I just downloaded is ubuntu-22.04-minimal-cloudimg-amg64.img

Before moving forward, run the following command:

qm set 901 --serial0 socker --vga serial0

Next you'll want to rename the file and change the file extension to .qcow2

Run the following command:

mv ubuntu-22.04-minimal-cloudimg-amg64.img ubuntu-min-2204server.qcow2

Set the disk size with the following command:

qemu-img resize ubuntu-min-2204server.qcow2 32G

Next, you'll want to run the following command to import ther drive to your VM in Proxmox:

qm importdisk 901 ubuntu-min-2204server.qcow2 local-zfs

Next, navigate in your Proxmox GUI to the Hardware section of your VM, and you'll find "unused disk 0" at the bottom. Select edit, and check the following boxes if you're using SSDs in your host machine:

image.png

image.png

The last step before starting the VM is to edit the Boot Order. You can do this by navigating to the Options tab within your VM. 

image.png

With all your configurations set, right-click on the machine and select "Convert to Template". To test everything's worked correctly, right click on the template and select "Clone" then select "Full Clone" for the mode:

image.png

Start your machine and test that it's working as configured!

 

 


Revision #2
Created 3 April 2024 02:47:35 by Austin
Updated 5 April 2024 01:31:05 by Austin