This document outlines the general procedure for adding new Template VMs in vSphere
for .ova
images.
The template VM in this guide refers to a regular vSphere VM and not VM Templates according to the vSphere terminology. The difference is quite subtle, but VM Templates are not supported yet by machine-controller.
OVA
filePrerequisites:
Procedure:
Download the OVA
for the targeted OS.
curl -sL "${OVA_URL}" -O .
Extract the specs from the OVA
:
govc import.spec $(basename "${OVA_URL}") | jq -r > options.json
Edit the options.json
file with your text editor of choice.
NetworkMapping
to point to the correct network.PowerOn
is set to false
.MarkAsTemplate
is set to false
.{
"DiskProvisioning": "flat",
"IPAllocationPolicy": "dhcpPolicy",
"IPProtocol": "IPv4",
"PropertyMapping": [
{
"Key": "guestinfo.hostname",
"Value": ""
},
{
"Key": "guestinfo.flatcar.config.data",
"Value": ""
},
{
"Key": "guestinfo.flatcar.config.url",
"Value": ""
},
{
"Key": "guestinfo.flatcar.config.data.encoding",
"Value": ""
},
{
"Key": "guestinfo.interface.0.name",
"Value": ""
},
{
"Key": "guestinfo.interface.0.mac",
"Value": ""
},
{
"Key": "guestinfo.interface.0.dhcp",
"Value": "no"
},
{
"Key": "guestinfo.interface.0.role",
"Value": "public"
},
{
"Key": "guestinfo.interface.0.ip.0.address",
"Value": ""
},
{
"Key": "guestinfo.interface.0.route.0.gateway",
"Value": ""
},
{
"Key": "guestinfo.interface.0.route.0.destination",
"Value": ""
},
{
"Key": "guestinfo.dns.server.0",
"Value": ""
},
{
"Key": "guestinfo.dns.server.1",
"Value": ""
}
],
"NetworkMapping": [
{
"Name": "VM Network",
"Network": "Kubermatic Default"
}
],
"MarkAsTemplate": false,
"PowerOn": false,
"InjectOvfEnv": false,
"WaitForIP": false,
"Name": null
}
Create a VM from the OVA
:
govc import.ova -options=options.json $(basename "${OVA_URL}")