Effortlessly Create Proxmox VE Debian Templates at Lightning Speed with Cloud-Init

Поділитися
Вставка
  • Опубліковано 18 чер 2024
  • If you ever plan on creating virtual machines in a hypervisor it makes sense to create a template and then clone that as it saves you a lot of time
    But creating a template by installing an operating system from an ISO image for instance can be time consuming itself
    And that's where Cloud-Init comes to the resuce because it saves you time when creating templates
    Now most Linux distros support this and although it's aimed at Cloud providers, you can also use this with Proxmox VE
    So in this video we show you how to create Debian templates and deploy VMs from them using Cloud-init
    NOTE: Make sure to delete the CloudInit drive from each VM you clone, once you've tested it works
    Useful links:
    cloud-init.io/
    cloud.debian.org/images/cloud/
    pve.proxmox.com/wiki/Cloud-In...
    pve.proxmox.com/wiki/Serial_T...
    =============================
    SUPPORT THE CHANNEL
    Donate through Paypal:
    paypal.me/DavidMcKone
    Donate through Buy Me A Coffee:
    buymeacoffee.com/dmckone
    Become a monthly contributor on Patreon:
    / dmckone
    Become a monthly contributor on UA-cam:
    / techtutorialsdavidmckone
    ==============================
    =============================
    MY RECORDING HARDWARE:
    Blue Yeti USB Microphone
    amzn.to/3IfL3qm
    Blue Radius III Custom Shockmount for Yeti and Yeti Pro USB Microphones
    amzn.to/3G3f89P
    RØDE PSA1 Professional Studio Arm
    amzn.to/3Z3lPBF
    Aokeo Professional Microphone Pop Filter
    amzn.to/3VuZl9H
    Sony Alpha ZV-E10L Mirrorless Camera
    amzn.to/3ITHCoU
    Elgato Cam Link 4K Capture Card
    amzn.to/43CzQaT
    Neewer NP-FW50 Dummy Battery Charger Kit
    amzn.to/3qp9Q4s
    Elgato Key Light Air - Professional 1400 lumens Desk Light
    amzn.to/3G81OB9
    Neewer 2 Packs Tabletop LED Video Light Kit
    amzn.to/3CcuN5O
    Elgato Green Screen
    amzn.to/3CoJBOL
    =============================
    ==============================
    MEDIA LINKS:
    Website - www.techtutorials.tv/
    Twitter - / dsmckone1
    ==============================
    For more technical information, including commands used, check out our blog post
    www.techtutorials.tv/sections...
    Chapters
    00:00 Intro
    00:39 Create Generic Linux Template
    08:30 Create Debian Template
    26:17 Create Debian VM
    36:08 Summary
    proxmox cloud init,proxmox cloud init template,proxmox cloud init debian,proxmox cloud init ssh key,proxmox cloud init drive,proxmox cloud-init,proxmox cloud-init tutorial,proxmox debian cloud image
  • Наука та технологія

КОМЕНТАРІ • 46

  • @TechTutorialsDavidMcKone
    @TechTutorialsDavidMcKone  7 місяців тому +3

    Make sure to delete the CloudInit drive from each VM you clone, once you've tested it works

  • @sinisterpisces
    @sinisterpisces 3 дні тому +1

    This is an amazing tutorial. I really appreciate your teaching style: by starting from zero but still explaining some of the more advanced options and when to (not) use them, you always leave me with a real sense that I understand *why* something works and that I'm not just pushing buttons and clicking things to make the mysterious black box spit out a result that I want. :)
    I really liked the advice to start with a master Linux template and base the Debian template off that one. I've not seen another guide do that, and it's been tickling the back of my mind uncomfortably for a week or so of researching this. Having one parent template that everything else springs from really helps me keep this ordered in my head, even before the benefits to actual deployment.
    I did have a few questions. My local storage is ZFS-based (an NVME mirror), and my eventual NAS-based storage will be ZFS-based as well (via TrueNAS/NFS). I'm starting out with local storage and planning to migrate to shared storage/the NAS later. This confuses me a bit, as it seems like I need to deal with RAW disks now (local storage), but will need to use qcow2 later (shared storage)? Is it possible to convert raw disks to qcow2 disks? Do I even need to do that? I've yet to find any guides to migrating VMs from local to shared storage with ZFS-based storage.

    • @TechTutorialsDavidMcKone
      @TechTutorialsDavidMcKone  3 дні тому

      Thanks for the feedback and good to know the video was helpful
      As for the drives, I've found Proxmox VE lets you change the format during a migration of the drive
      And it's better to use qcow2 than raw because then you can snapshot the VM, but you can only use raw when a physical drive is using LVM formatting
      If a drive is raw now, you can change that when you migrate it to a ZFS storage for instance, you'll probably find it will even chose qcow2 by default
      To migrate a drive, go into the hardware section of the VM, select the drive and in the top menu is a drop down menu called Disk Action
      Click on that and select Move Storage
      Then select the target storage and format choice
      I always tick the option at the bottom to delete the source drive whenever I migrate a drive, because otherwise it just wastes disk space
      Basically it copies the original file to the new target so that option is just an extra step to remove the original source file

  • @r2d23kk
    @r2d23kk 2 місяці тому +2

    I like how you explore all the useful options in each video :)

  • @BillyDickson
    @BillyDickson 7 місяців тому +1

    Thanks Dave, much appreciated, something for me to play about with during the festive period. 👍

    • @TechTutorialsDavidMcKone
      @TechTutorialsDavidMcKone  7 місяців тому +1

      Good to know you like the video
      I think coupling this with Ansible is going to save a lot of time

  • @khaalidi
    @khaalidi 7 місяців тому +1

    The content is incredibly informative, and I appreciate the effort you put into explaining everything so clearly. Thanks for creating such valuable and enjoyable content - keep up the great work! 👏👍

  • @vitusyu9583
    @vitusyu9583 2 місяці тому +1

    Thanks for your content! I have just setup my new Proxmox, and I am just spinning up a few nodes to run k8s. I’ve got some more knowledge of how Proxmox works after watching your demo.

  • @Aruneh
    @Aruneh 7 місяців тому +1

    Great video, much easier to follow than all the young and hip youtubers.

    • @TechTutorialsDavidMcKone
      @TechTutorialsDavidMcKone  7 місяців тому

      Glad to know you find the video helpful and liked the style
      Appreciate the feedback

  • @michaelcooper5490
    @michaelcooper5490 7 місяців тому

    You nailed it again David, Great job. I am becoming a huge fan,

    • @TechTutorialsDavidMcKone
      @TechTutorialsDavidMcKone  7 місяців тому +1

      Good to know the videos are helpful
      I've plenty more in the pipeline so hopefully you'll find a benefit in them

  • @joezaino4674
    @joezaino4674 2 місяці тому +1

    Well, I was there and I saw what you did and I found it very useful.

  • @thisiswaytoocomplicated
    @thisiswaytoocomplicated 6 місяців тому +1

    To me cloud-init only makes sense with actual cloud-providers. Because that is the lowest common denominator and the best you can get in that area.
    Proxmox you run yourself so you are not limited by this constraints. You have full control and access. No need to limit yourself.
    So personally I prefer ansible for automation (or you can use puppet or chef, etc.). You can manage Proxmox itself with it. You can manage and configure virtual machines with it in all aspects and it is just much more versatile.
    Need a postgres server? - add the role and fill in a few variables. It will take care of installing postgres, setting up databases, schemas, roles, users, etc.
    Need postfix? - add the role, set a few variables, run it, done.
    Need a kubernetes cluster with all of its components fully configured? - add suitable roles, run it, also done.
    If you want to do infrastructure as code - don't only do it half-way.

    • @TechTutorialsDavidMcKone
      @TechTutorialsDavidMcKone  6 місяців тому

      In this video we're only talking about an OS template for future VMs and not about one for an entire application
      So as I mentioned for instance, Ansible could be used to take over the VM once it was up and running
      The main appeal of using a cloud-init image for creating templates like this is that it saves so much time compared to a fresh installation of an OS
      There's no time wasted during the setup process having to answer questions or wait a long while for the installation to then be carried out
      And although there are some interesting tools out there that can help with that, this to me is so much quicker and simpler to deploy
      That's because the OS is slimmed down and pre-installed, so PVE only needs a few extra details to hand over to a new VM when it first boots up

    • @thisiswaytoocomplicated
      @thisiswaytoocomplicated 6 місяців тому

      @@TechTutorialsDavidMcKone I understand - still I don't like the extra complexity involved with it. Just more black-magic layers.
      Most straight forward way to me still is unattended install. That simply answers all installation questions for you. Once you have a template (you can download it for example from Debian) and set it up once then you are done. Lightning fast installation.
      And if you want you still can tweak things - like disk partitioning, choice of file systems, packages to install and so on. Much more versatile and still very fast. You should try it.
      Not as chiqué maybe as using something with "cloud" in its name, but works like a charm.

  • @jleonardolemos
    @jleonardolemos 15 днів тому +1

    Big class!!! I keep asking how much do we should deliver in a pre baked image and how much should we do on the VM creation. For exemple if i have all my VMs observed by Zabbix should i deliver zabbix agent inside the template or should i install in a automated way when the VM is created??

    • @TechTutorialsDavidMcKone
      @TechTutorialsDavidMcKone  15 днів тому

      Templates are very useful but now I'm steering towards automating as much as possible; less to backup, quicker to recover, quicker to modify, etc
      Another benefit of automation though is it's easier to scale because you just deploy the same change
      And as long as you test a change in a lab, you should get the same result in production

  • @vasquezmi
    @vasquezmi 2 місяці тому +1

    @Tech Tutorials - Excellent walk-through I appreciate you sharing your expertise. At ~ 30:05 you went into a file that I assume you created to show recent leases in your network. Is that process something you have shared in your videos?
    Thanks in advance on any direction with that.

    • @TechTutorialsDavidMcKone
      @TechTutorialsDavidMcKone  2 місяці тому

      I'm running Kea as a DHCP server
      If you're interested in setting that up I have a video for it
      ua-cam.com/video/FGw06CSLizY/v-deo.html

    • @vasquezmi
      @vasquezmi 2 місяці тому

      @@TechTutorialsDavidMcKone Thank you so much for the quick reply. I saw it the other day but like all of us got caught up in things. Now that the smoke has cleared I am going to review. I hope you have an excellent week.

  • @zyghom
    @zyghom 7 місяців тому +1

    I went the path of installing Debian, customizing it (that is much more than IP or so: some scripts, some extra programs etc.) and only then converting it to template and then cloning to have new VM. That included also mounting shared disks etc. Yes, hostname is the same but setting new hostname is ... 1 command and 1 file edited, right? ;-)

    • @TechTutorialsDavidMcKone
      @TechTutorialsDavidMcKone  7 місяців тому

      Yeah "golden" images have been created for a long long time
      I've been doing that myself ever since the likes of Ghost was released...
      Wow, just looked at the Wiki. That was a long time ago ;)
      Anyway, as you say though, once it's built the hostname and hosts file need editing. Which is very little given the time saving
      But my grand plan now is infrastructure as code
      Apart from the initial PVE install and basic network setup, I want to see just how far I can push Ansible to build everything from the ground up and maintain it going forward

  • @ncarrasco2006
    @ncarrasco2006 3 місяці тому +1

    Do you know what is the difference between debian-12-generic-amd64-20240211-1654.qcow2 and debian-12-genericcloud-amd64-20240211-1654.qcow2 ?

    • @TechTutorialsDavidMcKone
      @TechTutorialsDavidMcKone  3 місяці тому

      It seems generic-cloud is more for virtual environments as it's missing drivers for physical hardware
      cloud.debian.org/images/cloud/

  • @AdrianuX1985
    @AdrianuX1985 7 місяців тому +1

    +1

  • @JamesTremblay
    @JamesTremblay Місяць тому

    Holly 🐄, you blather on like we are children....

    • @TechTutorialsDavidMcKone
      @TechTutorialsDavidMcKone  Місяць тому +1

      Any interesting perspective but bear in mind there is a large audience out there, with different backgrounds, different levels of understanding and each with their own take on the type of content they want
      Now, not many videos go into the details that I look for
      Folks are told to just to do this, do that without any explanation as to why
      That's the type of video I would be interested in, hence why I make videos this way

  • @ncarrasco2006
    @ncarrasco2006 3 місяці тому +1

    I notice that if for example I create a VM with 2GB of ram installing debian from debian-12.5.0-amd64-netinst.iso without cloud init , when I start for proxmox it is using 1.4GB of ram. But if later I boot one time with cloud-init one time , the memory usage is less than 400 MB . I wonder why the memory usage is reduced ? Does cloud init installs something ?

    • @TechTutorialsDavidMcKone
      @TechTutorialsDavidMcKone  3 місяці тому

      The netinst.iso file is the version for typical installation onto a hard drive and is independent of cloud-init
      Cloud-init is a cloud ready version of the Linux distro which is a pre-built drive i.e. you boot off that and it just needs some extra details to complete the installation
      So with Proxmox VE you add a cloud-init IDE drive with those instructions
      The cloud-init version also has less software installed, so is much lighter, but you can always add what you want/need

    • @ncarrasco2006
      @ncarrasco2006 3 місяці тому

      Hi, but it can be really so much the difference ? Maybe I am measuring differently or there is a service that reports the memory usage different ? @@TechTutorialsDavidMcKone

    • @TechTutorialsDavidMcKone
      @TechTutorialsDavidMcKone  3 місяці тому

      @@ncarrasco2006 Have you checked usage from the Debian side or the Proxmox side?
      Even with the guest agent installed, I still think it's best to check what Debian says it's using
      But the cloud-init images are a lite version

    • @ncarrasco2006
      @ncarrasco2006 3 місяці тому

      Thanks right now I am experimenting using solely virt-install (without proxmox) @@TechTutorialsDavidMcKone

    • @ncarrasco2006
      @ncarrasco2006 3 місяці тому

      yes, I will check. I have issues using cloud-init with the debian images @@TechTutorialsDavidMcKone

  • @traxeonic3600
    @traxeonic3600 4 місяці тому +2

    Really enjoyed this video. It helped jump start my templating journey with proxmox. I did come across another helpful bit of content while trying to see if I could get a leg up on the image itself. The following commands allow you to inject some packages that are helpful, particularly the agent. the last command helps you to avoid the resize step in the video.
    ```
    sudo apt install libguestfs-tools -y
    mv debian-12-generic-amd64.qcow2 debian-12-generic-amd64-mod.qcow2
    virt-customize -a debian-12-generic-amd64-mod.qcow2 --install qemu-guest-agent,ncat,net-tools,bash-completion
    qemu-img resize debian-12-generic-amd64-mod.qcow2 32G
    ```
    After making these changes, I particularly like that when the VM fires up from the clone, you can see the IP in Proxmox without hunting in DHCP to find it.

    • @TechTutorialsDavidMcKone
      @TechTutorialsDavidMcKone  4 місяці тому +1

      Thanks for sharing and good to know the video was useful
      I found using cloud-init made things a whole lot easier
      Initially I would use it to build the template and then hand it over to Ansible
      But now I've got Ansible building the entire VM from a cloud-init image
      Part of that work involves injecting commands like you've mentioned as part of the cloud-init install as there's quite a few things it can do beyond what the GUI allows

    • @traxeonic3600
      @traxeonic3600 4 місяці тому

      There is a lot of people who advocate for using Terraform for infrastructure management and then use Ansible for configuration control, but I do see the appeal to reducing complexity and working from a single tool as well. Thanks again.@@TechTutorialsDavidMcKone