Effortlessly Create Proxmox VE Debian Templates at Lightning Speed with Cloud-Init
HTML-код
- Опубликовано: 28 май 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 RUclips:
/ 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 - Наука
Make sure to delete the CloudInit drive from each VM you clone, once you've tested it works
I like how you explore all the useful options in each video :)
Thanks for the feedback, always appreciated
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.
Thanks for the feedback
And good to know the video was helpful
Well, I was there and I saw what you did and I found it very useful.
That's good to know
Great video, much easier to follow than all the young and hip youtubers.
Glad to know you find the video helpful and liked the style
Appreciate the feedback
Thanks Dave, much appreciated, something for me to play about with during the festive period. 👍
Good to know you like the video
I think coupling this with Ansible is going to save a lot of time
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.
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
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
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! 👏👍
Thanks for the feedback and good to know you found the video useful
You nailed it again David, Great job. I am becoming a huge fan,
Good to know the videos are helpful
I've plenty more in the pipeline so hopefully you'll find a benefit in them
@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.
I'm running Kea as a DHCP server
If you're interested in setting that up I have a video for it
ruclips.net/video/FGw06CSLizY/видео.html
@@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.
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.
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
@@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.
Do you know what is the difference between debian-12-generic-amd64-20240211-1654.qcow2 and debian-12-genericcloud-amd64-20240211-1654.qcow2 ?
It seems generic-cloud is more for virtual environments as it's missing drivers for physical hardware
cloud.debian.org/images/cloud/
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? ;-)
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
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 ?
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
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
@@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
Thanks right now I am experimenting using solely virt-install (without proxmox) @@TechTutorialsDavidMcKone
yes, I will check. I have issues using cloud-init with the debian images @@TechTutorialsDavidMcKone
Holly 🐄, you blather on like we are children....
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
+1
Thanks