Clusterwide VM templates

Discussion in 'Proxmox VE: Installation and configuration' started by morph027, Oct 11, 2018.

  1. morph027

    morph027 Active Member

    Joined:
    Mar 22, 2013
    Messages:
    408
    Likes Received:
    49
    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?
     
  2. D0peX

    D0peX New Member

    Joined:
    May 5, 2017
    Messages:
    26
    Likes Received:
    0
    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
     
  3. morph027

    morph027 Active Member

    Joined:
    Mar 22, 2013
    Messages:
    408
    Likes Received:
    49
    Yes, container templates are working this way, but I'm talking about KVM templates.
     
  4. LnxBil

    LnxBil Well-Known Member

    Joined:
    Feb 21, 2015
    Messages:
    3,694
    Likes Received:
    329
    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.
     
  5. spirit

    spirit Well-Known Member

    Joined:
    Apr 2, 2010
    Messages:
    3,311
    Likes Received:
    131
    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.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  6. morph027

    morph027 Active Member

    Joined:
    Mar 22, 2013
    Messages:
    408
    Likes Received:
    49
    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
     
  7. morph027

    morph027 Active Member

    Joined:
    Mar 22, 2013
    Messages:
    408
    Likes Received:
    49
    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
    
     
  8. spirit

    spirit Well-Known Member

    Joined:
    Apr 2, 2010
    Messages:
    3,311
    Likes Received:
    131
    can you post your /etc/pve/storage.cfg ?
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  9. morph027

    morph027 Active Member

    Joined:
    Mar 22, 2013
    Messages:
    408
    Likes Received:
    49
    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
    
     
  10. spirit

    spirit Well-Known Member

    Joined:
    Apr 2, 2010
    Messages:
    3,311
    Likes Received:
    131
    mmm,ok, got it.

    Indeed, the clone is done on a local node, where the vm is template is located.

    the only way currently is to move the template to the node where the target local storage is located.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice