Clusterwide VM templates

morph027

Renowned Member
Mar 22, 2013
450
63
93
Leipzig
morph027.gitlab.io
Hi!

I really love the cloud-init integration and with the templating, it's really easy to spawn new vms. However, i'm unable to create a template for the whole cluster. I'd like to have a template on some kind of shared storage (like NFS) and create full clones of this template on all nodes (and their local zfs storages). Is this possible?
 
Yeah,
I have a NAS running on my network with an NFS mount for my Proxmox hosts.
Every host has this connection as it is connected on a Cluster-level.

When i would create a VM/Template, I can select from the NFS storage:
upload_2018-10-11_21-9-49.png
---
upload_2018-10-11_21-10-7.png
 
Yes, container templates are working this way, but I'm talking about KVM templates.

What exactly does not work, because we use it for years in our cluster. Every VM (KVM and LXC based) is visible in the cluster, so it can be cloned. We have a pool for templates and a special prefix number (8xxx):

upload_2018-10-12_12-44-41.png

We have "finalized" templates, that are in deed "real" PVE templates - all other are normal machines which gets updated frequently and then cloned.
 
The only current limitation, is that a template on a local storage, can only be cloned on another storage attached to the same node.

if your template is on a shared storage, you can cloned it on any host and any storage.
 
I've got a template created like this:

Code:
qm create 9000 --balloon 1024 --memory 2048 --cores 2 --net0 virtio,bridge=vmbr0 -name cloudinit-template-ubuntu
qm importdisk 9000 /mnt/pve/barney/template/ubuntu-18.04-minimal-cloudimg-amd64.img barney
qm set 9000 --scsihw virtio-scsi-pci --scsi0 barney:9000/vm-9000-disk-0.raw
qm set 9000 --ide2 barney:cloudinit
qm set 9000 --boot c --bootdisk scsi0
qm set 9000 --serial0 socket --vga serial0
qm template 9000

barney is a PVE server with NFS server available on all other nodes as well.

When trying to clone on another node (e.g. itchy), i only have "Same as source" or "barney" as Target Storage, but I'd like to clone to local ZFS pool.
Bildschirmfoto vom 2018-10-12 15-26-10.png
 
Code:
root@barney:~# qm config 9000
balloon: 1024
boot: c
bootdisk: scsi0
cores: 2
ide2: barney:9000/vm-9000-cloudinit.qcow2,media=cdrom
memory: 2048
name: cloudinit-template-ubuntu
net0: virtio=E6:13:14:1F:0C:A9,bridge=vmbr0
scsi0: barney:9000/base-9000-disk-0.raw,size=2252M
scsihw: virtio-scsi-pci
serial0: socket
smbios1: uuid=13815d33-124c-4d33-ace0-972eea9bc6aa
template: 1
vga: serial0
vmgenid: 7bd01587-e9c3-4df7-9e64-0052591823ef
 
Code:
oot@barney:~# cat /etc/pve/storage.cfg
dir: local
   path /var/lib/vz
   content images,iso,vztmpl,rootdir
   maxfiles 0

zfspool: rpool-vm
   pool rpool/vm
   content rootdir,images
   sparse 1

zfspool: rpool-non-critical-vm
   pool rpool/non-critical-vm
   content images,rootdir
   sparse 1

nfs: barney
   export /data/proxmox/vz
   path /mnt/pve/barney
   server barney
   content vztmpl,iso,backup,images
   maxfiles 5
   options vers=3
 
What spirit said or you can copy the template config file to another node with another name: /etc/pve/nodes/<nodes name>/qemu-server/<name of config file>.conf
cp /etc/pve/nodes/<old node>/qemu-server/9000.conf /etc/pve/nodes/<new node>/qemu-server/9001.conf
 
Last edited:

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!