Last post was all about creating Virtual Machines through VM Services operator provided by vSphere with Tanzu, which would give immediately freedom of choice to Developers when it comes to choose how their application might be made of; Containers, Pods, VMs, a mix of all of them .... in fact it does not matter anymore, they can build and run any of them just the same way.
Honestly, my previous post just shows how to create VMs, All the fun comes now when we can customize it during provisioning.
Guest customization is performed by the use of Cloud-Init, mainly because it became one of the most popular customization tools out there, meaning that you can leverage all that beauty you already have created.
Cloud-Init also provides dozens of modules since basic things like creating Users and Groups, Repo configuration, Packages installation, but also more advanced functions like integration with Puppet and Chef. As a start I suggest going through the examples available on their portal.
Back to my initial ConfigMap, it just had basic customization
Let's see how we can pimp this code:
First create your cloud-init file with the customization you want to make. I made a basic one, just user's creation, set it's password, install some package and run a command.
Although it's available on my git, it's far from being considered best practices, use it at your own risk !!
Once it's done, you will add it to ConfigMap under user-data section, which by the way need to be base64
just run: cat "cloud-init-file" | base64
It's all set now, you can create your VMs just as I showed on the previous post.
Good customization !!!