VMware vSphere and Juju

List of supported clouds > VMware vSphere

This document describes details specific to using your existing VMware vSphere cloud with Juju.

See more: VMware vSphere

When using the VMware vSphere cloud with Juju, it is important to keep in mind that it is a (1) machine cloud and (2) not some other cloud.

See more: Cloud differences in Juju

As the differences related to (1) are already documented generically in our Tutorial, How-to guides, and Reference docs, here we record just those that follow from (2).

Juju points of variation Notes for the VMware vSphere cloud
setup (chronological order):
CLOUD
supported versions:
requirements: In order to add a vSphere cloud you will need to have an existing vSphere installation which supports, or has access to, the following:

- VMware Hardware Version 8 (or greater)

- ESXi 5.0 (or greater)

- Internet access

- DNS and DHCP

Juju supports both high-availability vSAN deployments as well and standard deployments.

definition:
- name: user-defined
- type: vsphere
- authentication types: [userpass]
- regions: [TO BE ADDED]
- cloud-specific model configuration keys: datastore
The datastore in which to create VMs. If this is not specified, the process will abort unless there is only one datastore available.

disk-provisioning-type
This dictates how template VM disks should be cloned when creating a new machine.
Valid values:

- thin - Sparse provisioning, only written blocks will take up disk space on the datastore

- thick - The entire size of the virtual disk will be deducted from the datastore, but unwritten blocks will not be zeroed out. This adds 2 potential pitfalls. See comments in provider/vsphere/internal/vsphereclient/client.go regarding DiskProvisioningType.

- thickEagerZero (default) - The entire size of the virtual disk is deducted from the datastore, and unwritten blocks are zeroed out. Improves latency when committing to disk, as no extra step needs to be taken before writing data.

external-network
An external network that VMs will be connected to. The resulting IP address for a VM will be used as its public address. An external network provides the interface to the internet for virtual machines connected to external organization vDC networks.

force-vm-hardware-version (integer)
Adds a new model level flag that allows operators to set a newer compatibility version for the instances that get spawned by juju. E.g., juju bootstrap vsphere --config force-vm-hardware-version=17

primary-network
The primary network that VMs will be connected to. If this is not specified, Juju will look for a network named VM Network.

CREDENTIAL
definition: auth-type: userpass. You will have to provide your username, password and, optionally, the vmfolder.

:warning: If your credential stops working: Credentials for the vSphere cloud have been reported to occasionally stop working over time. If this happens, try juju update-credential (passing as an argument the same credential) or juju add-credential (passing as an argument a new credential) + juju default-credential.

CONTROLLER
notes on bootstrap: Recommended: Bootstrap with the following cloud-specific model-configuration keys: datastore and primary-network. See more below.

Pro tip: When creating a controller with vSphere, a cloud image is downloaded to the client and then uploaded to the ESX host. This depends on your network connection and can take a while. Using templates can speed up bootstrap and machine deployment.

other (alphabetical order:)
CONSTRAINT
conflicting:
supported?
- allocate-public-ip :x:
- arch :white_check_mark:
Valid values: [amd64, i386].
- container :white_check_mark:
- cores :white_check_mark:
- cpu-power :white_check_mark:
- image-id :x:
- instance-role :x:
- instance-type :white_check_mark:
- mem :white_check_mark:
- root-disk :white_check_mark:
- root-disk-source :white_check_mark:
root-disk-source is the datastore for the root disk
- spaces :x:
- tags :x:
- virt-type :x:
- zones :white_check_mark:
PLACEMENT DIRECTIVE
<machine> TBA
subnet=... :x:
system-id=... :x:
zone=... :white_check_mark:
MACHINE
RESOURCE (cloud)

Consistent naming, tagging, and the ability to add user-controlled tags to created instances.

:x:

Other notes

Using templates

To speed up bootstrap and deploy, you can use VM templates, already created in your vSphere. Templates can be created by hand on your vSphere, or created from an existing VM.

Examples assume that the templates are in directory $DATA_STORE/templates.

Via simplestreams:

mkdir -p $HOME/simplestreams
juju-metadata generate-image -d $HOME/simplestreams/ -i "templates/juju-focal-template" -s focal -r $DATA_STORE -u $CLOUD_ENDPOINT
juju-metadata generate-image -d $HOME/simplestreams/ -i "templates/juju-bionic-template" -s bionic -r $DATA_STORE -u $CLOUD_ENDPOINT
juju bootstrap --metadata-source $HOME/image-streams vsphere

Bootstrap juju with the controller on a VM running focal:

juju bootstrap vsphere --bootstrap-image="templates/focal-test-template"  --bootstrap-series=focal --bootstrap-constraints "arch=amd64"

Using add-image:

juju metadata add-image templates/bionic-test-template --series bionic

Levels of placement

When creating a controller, there are three levels of placement that Juju understands: cloud, region, and availability zone. In vSphere, these are mapped in two different ways depending on your topology:

  • cloud (vSphere endpoint), region (Datacenter), availability zone (host)
  • cloud (vSphere endpoint), region (Datacenter), availability zone (cluster)

If your topology has a cluster without a host, Juju will see this as an Availability Zone and may fail silently. To solve this, either make sure the host is within the cluster, or use a placement directive:

juju bootstrap vsphere/<datacenter> <controllername> --to zone=<cluster|host>

To create a controller using Datacenter ‘dc1’ you would enter the following:

juju bootstrap vsp-cloud/dc1 vsp-controller

Specify a datastore when deploying an application

There is a constraint called ‘root-disk-source’ that can stipulate the name of a vSphere datastore to house the root disk:

juju deploy myapp --constraints root-disk-source=mydatastore

Deploy applications to a specific host or cluster

Resource pools within a host or cluster can be specified with the ‘zones’ constraint:

juju deploy myapp --constraints zones=myhost
juju deploy myapp --constraints zones=myfolder/myhost
juju deploy myapp --constraints zones=mycluster/mypool
juju deploy myapp --constraints zones=mycluster/myparent/mypool

Last updated 2 days ago. Help improve this document in the forum.