Automated, Self-Service Provisioning of VMs Using HyperForm (Part 2)
Now that you've got your VMs, put them to use. See how to provision your clusters so you can get the most out of them.
Join the DZone community and get the full member experience.
Join For FreeWelcome back to learning how to create an automated, self-service provisioning system for your VMs. In part one, we learned how to set up and register your virtual machines on Hyper-V using HyperForm. Now, we delve into provisioning. Without further delay...
Provisioning Virtual Machines on Hyper-V
A user can provision Hyper-V virtual machines on the newly created cluster either through a UI-based workflow or by defining a simple YAML-based Machine Compose template that can be requested from the Self-Service Library. The recommended approach is the Machine Compose template as it provides more security and standardization.
UI-based Workflow: A user can request a Hyper-V virtual machine by navigating to Machines and then clicking on the +New button to select Hyper-V. Once the Cloud Provider is selected, a user can select the following options:
- Node: The Hyper-V Node on which the new VM's will be provisioned.
- Instance Type Pre-defined templates are available that specify the CPU, Memory, Disk and Generation for the VM (e.g. cpu=1,memory=2GB,disk=100GB,generation=1). A user can customize these value to his/her needs.
- Image: This is the .VHDX template that will be used for provisioning.
- Network: This is the virtual network that will be used for the new VM.
- Skip Agent Install: This option can be selected if the VM template has the HyperForm agent already pre-installed.
- Username: This is the username needed to log into the VM.
- Password: This is the password needed to log into the VM.
- Cluster: This is the HyperForm cluster that is created by the user.
- VM Count: This is the number of VM's that can be provisioned simultaneously.
A user can then click on the Machine Compose button to generate a YAML-based Machine Compose template. This can be used to create your own standard Machine Compose template that can be shared with other users with granular access controls.
A user can create a Machine Compose template for Hyper-V by navigating to Blueprints > App/Machine and then clicking on the +New button to select Machine Blueprint.
Here’s an example template for requesting a 4GB virtual machine on Hyper-V.
The supported parameters for the Machine Compose template are summarized below:
- description: Description of the blueprint/template.
- instanceType: Mandatory: Cloud provider specific value (e.g. cpu=1,memory=4GB,disk=100GB,generation=1).
- region: Mandatory: The name of the Hyper-V Node.
- image: Mandatory: Fully qualified path of the .VHDX template (e.g. \\VFCN10-AD\HyperForm\Template\HyperForm_Ubuntu-14.04_64_10.0.254.100.vhdx).
- username: This the username used to connect to the VM.
- password: This can reference a private key stored in the Credentials store. The ID of the credential item stored in the Cloud Providers > Credentials page will be needed. Here's the acceptable format: "{{credentials | 2c91802a520736224015209a6393098322}}".
- network: Cloud provider specific value (e.g. Virtual Switch1).
- count: Total no of VM's, defaults to 1.
In addition to these supported parameters, you will also notice that this template is referencing a "plugin". A plugin can be invoked as follows:
plugins:
- !plugin
id:
- Installing Puppet Modules, Chef Recipes, Ansible Playbook, etc.
- Retrieving the CA certificate needed for the private Docker registry from a secure S3 bucket and then saving it in the right directory (e.g. /etc/docker/certs.d/<domain-name>:5000/ca.crt).
The Machine Compose template has additional advanced options.
- Cost Profiles: These are the cost profiles that you can create under Policies > Cost Profiles. You can define cost per resource on an hourly/weekly/monthly basis. You can attach multiple cost profiles to a single template — e.g. different cost profiles for the instance type, EBS storage used, etc.
- Entitled Users: These are the users who are allowed to use this template to provision AWS instances. The entitled users do not have permission to manage or delete this template and will only be able to consume it.
Once the Machine Blueprint is saved, a user can request this machine from the Self-Service Library. A user can click Customize and then select the Cloud Provider and Cluster to use for provisioning the Hyper-V Virtual Machines.
Once the Hyper-V VM is provisioned, a user can monitor key statistics like CPU, Memory, Disk Utilization and Containers Running. This can be done by navigating to Machines and then selecting Monitoring or Stats from the Manage drop-down menu.
An in-browser terminal to the provisioned machine is also accessible. This can be accessed by navigating to Machines and then selecting Terminal from the Manage drop-down menu.
A list of the deployed applications on a virtual machine is also accessible. This can be accessed by navigating to Machines and then selecting Apps from the Manage drop-down menu.
Now that your cluster is set up, you can now run any Docker application on the newly created server(s). This can be done by navigating to the Library and then clicking on Customize on any of the published application templates. You can then select a Cluster and click Run.
Published at DZone with permission of Amjad Afanah, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.
Comments