Thursday, September 9, 2021

Customizing VMs with Cloud-Init

 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

Now just copy the code and past under the user-data... make sure it's a single line of code.




It's all set now, you can create your VMs just as I showed on the previous post.

 

Good customization !!!


No comments:

Post a Comment

Who am I

My photo
I’m an IT specialist with over 15 years of experience, working from IT infrastructure to management products, troubleshooting and project management skills from medium to large environments. Nowadays I'm working for VMware as a Consulting Architect, helping customers to embrace the Cloud Era and make them successfully on their journey. Despite the fact I'm a VMware employee these postings reflect my own opinion and do not represents VMware's position, strategies or opinions. Reach me at @dumeirell

Most Viewed Posts

Blog Archive