For quite awhile I’ve been challenged to find a small Linux VM to do small tasks like demonstrating connectivity (ping) between a couple of *magic* SDN segments, or running an application that’s only available on, or well… just better on Linux. Here we’ll go through a quick run down on how you can build these easily and quickly. Future posts will build on this lab VM idea and we’ll add more functionality.
Once you’ve got your VCF lab up using VLC what do you do with it? I tend to experiment with everything I can but it’s mostly guided by what I’ve been talking to customers about most recently. What led me to make this post was the need for several VM’s to represent a multi-site, multi-tier app. It needed to demonstrate that the different components could move from site to site with no VM level changes were needed, and little impact to the application, marginally higher latency for pieces was ok.
The first thing I did was of course, Google “tiny linux vm”. This brought up a few options, one of the good ‘ole standby’s is Tiny Core Linux. Unfortunately I’m unable to find the OVA that once was, and IIRC the VMtools and hardware were quite out of date. I decided to take a look at Photon OS which is what VMware uses for almost all of the appliances. To my delight the Photon team has already packaged it up as an OVA that clocks in at 217mb!
I downloaded the OVA with Virtual Hardware v13 (UEFI Secure Boot <- You can disable this in the VM options before creating a template if needed) from the Github link above and imported it into my management domain vCenter, right clicking on the cluster and selecting Deploy OVF Template. This only required a VM name, accept the EULA and that I select the compute, storage and network.
While this was importing, which took less that 5 minutes, I created a new VM customization specification. In vCenter this can be found by clicking Menu -> Policies and Profiles -> VM Customization Specification -> New
In this wizard I had to give the specification a name (VMSpec-Photon), and selected Linux for my Target guest OS
On the next screen you’ll leave Use the virtual machine name, and you’ll need to add a domain name. I usually set this to my lab’s domain name, “vcf.sddc.lab”
Then set your timezone, mine is America -> Chicago. Then, for now just click next on the customization script, Network, DNS settings, and then click finish. Don’t worry, what we’re skipping IS important.. just not right now 😉
Now, head to your VM and Templates view. Out of all the views in vCenter, for some reason this is my least favorite, except in this instance. Find the VM that we deployed before and power it on. Access the web console and after it’s booted enter “root” for the username and “changeme” for the password. It will prompt you to enter the current password (changeme) and then your new password twice. After this, shut the VM down and then right click it -> Clone -> Clone to template.
This should only take a few minutes to complete and once it does, we’re ready to start deploying some lab VM’s! Find the template that got created, it has a different icon and will only be visible in the VM and Templates view. Right click it and select New VM from This Template.
Choose a name for your new VM, select the target cluster and storage and then under Select Clone Options select the Customize the operating system checkbox and click Next. While we won’t go through this, if you want to have this VM on a different network (segment) you would also check the “Customize this virtual machine’s hardware” box and simply select the network for the NIC to attach to. You could also tick the Power on checkbox for *maximum effeciency* 😀
Next you’ll want to select the VM Spec we created and select the OVERRIDE link directly above it.
With this override option you can essentially change every option of the customization spec on a per VM basis. For instance, if you had to deploy VM’s to different networks with different subnets you’re able to do that here. This is also advantageous for another reason in that you don’t have to edit, modify or create any files on the VM to assign it a static IP, set it’s DNS, or domain name. It’s all ready to go with the values we set here.
Once you’re done “overriding” the spec click finish and your new VM will be deployed with the configuration set above! While it’s a bit of work to do up front the VM specification can be exported. Once you do this you can rebuild your lab and import the VM, convert it to a template and them import the VM specification and start deploying lab VMs. The VM specification is exported as an XML file
<ConfigRoot> <_type>vim.CustomizationSpecItem</_type> <info> <_type>vim.CustomizationSpecInfo</_type> <changeVersion>1639607170</changeVersion> <description/> <lastUpdateTime>2021-12-15T22:26:10Z</lastUpdateTime> <name>VMSpec-Photon</name> <type>Linux</type> </info> <spec> <_type>vim.vm.customization.Specification</_type> <globalIPSettings> <_type>vim.vm.customization.GlobalIPSettings</_type> </globalIPSettings> <identity> <_type>vim.vm.customization.LinuxPrep</_type> <domain>vcf.sddc.lab</domain> <hostName> <_type>vim.vm.customization.VirtualMachineNameGenerator</_type> </hostName> <hwClockUTC>true</hwClockUTC> <scriptText/> <timeZone>America/Chicago</timeZone> </identity> <nicSettingMap> <_length>1</_length> <_type>vim.vm.customization.AdapterMapping</_type> <e id="0"> <_type>vim.vm.customization.AdapterMapping</_type> <adapter> <_type>vim.vm.customization.IPSettings</_type> <ip> <_type>vim.vm.customization.DhcpIpGenerator</_type> </ip> </adapter> </e> </nicSettingMap> <options> <_type>vim.vm.customization.LinuxOptions</_type> </options> </spec> </ConfigRoot>
As a preview of what’s coming in future blog posts, we’re going to get the package manager updated, install some utilities and install some Kubernetes tools to work with our Tanzu environment that’s setup in our VLC built VCF instance. Thanks for reading!