Deploying virtual machines and containers to the private cloud (VMware vSphere)

Last updated 13 March, 2019

About virtual machines (VMware vSphere)

As a consumer, you can use the HPE OneSphere application UI to deploy resources that the administrator has curated for your assigned projects.

You can then deploy virtual machines from the project based on the images that are made available through the connected VMware environment.

Deploying virtual machines from HPE OneSphere to VMware environments allows you to specify the cluster, virtual machine profile, and network to connect to the virtual machine. You can then connect a storage volume to the virtual machine.

Deploying a virtual machine to a VMware vSphere private cloud

Virtual machines deployed from HPE OneSphere to a VMware vSphere environment contain the default block storage and contain the compute and memory resources that are defined in the selected image in the catalog.

Prerequisites

The administrator:

Procedure
  1. From the HPE OneSphere main menu, click Projects.

    (Administrator users can click Catalog, and skip steps 2, 3, and 4.)

  2. Click a project that you want to associate with the virtual machine deployment.
  3. On the Projects screen, click Deployments.

    Members of the selected project can view and manage the virtual machine after it is deployed.

  4. From the top right corner, click the plus sign  to the right of Deployments. The Catalog screen opens.
  5. Browse or search the catalog for items labeled VMware Templates, or filter the results to show only VMware templates.

    The template is the software that will be deployed on the virtual machine to create a virtual machine instance. 

    NOTE:

    Windows templates must be prepared with cloud-init and sysprep in VMware vSphere before the images can be used by HPE OneSphere to deploy virtual machines to a VMware private cloud.

  6. Click the three dots in the lower right corner of the catalog item, then select Deploy
    If you selected the item, deselect it to see the three dots.
  7. On the Deploy panel:
    1. Enter a Name for the new virtual machine.

      NOTE:

      Be sure to specify a unique name. HPE OneSphere does not prevent you from specifying a duplicate name if another virtual machine deployment is occurring at the same time.

      Do not specify restricted characters <>={}(),";& in the virtual machine name. These characters are used as dimension values in the HPE OneSphere monitoring service.

    2. From the Project drop-down menu, select the project where the virtual machine will be deployed.
    3. From the Zone drop-down menu, select a zone where the virtual machine will be deployed.
    4. From the Virtual Machine Profile drop-down, select the pre-defined flavor.
  8. Click Customize Deployment.
    1. Click the plus sign  to the right of Networks to display a drop-down list of networks previously assigned to the project by an administrator.

      For information about how to add networks to a project, see Managing projects.

    2. Select the network and click Add. The selected network appears below the list of networks. You can add multiple networks based on your requirements.
    3. (Optional) Paste the contents of a cloud-init file into the text box.

      A cloud-init file allows you to customize the virtual machine instance with a hostname, default locale, and other details. For examples, see http://cloudinit.readthedocs.io/en/latest/topics/examples.html.

    4. (Optional) Under SSH Public Key, click Choose File and browse to a file to upload, or paste a key into the text box.

      Public SSH keys are usually located at ~/.ssh/id_rsa.pub.

      See Creating an SSH public key pair.

  9. Select the network and click Add. The selected network appears below the list of networks. You can add multiple networks based on your requirements.
  10. Click Deploy.

    After the virtual machine is deployed, you can view the details of the created virtual machine in your project.

Updating cluster connections (VMware vSphere)

For a specific zone, you can update the cluster connection, datastore connection, and the workspaces from which you allow members to access virtual machines in the zone.

Prerequisites

The administrator deployed a virtual machine to the private cloud.

Procedure
  1. From the HPE OneSphere main menu, click Providers.
  2. Click Private Zones.
  3. From the list, click the zone that contains the cluster you want to update.
  4. Click the Update Zone link below the zone name to display the Update Zone panel with the list of available cluster connections.
  5. From the Cluster Connection section, you can activate or deactivate the cluster:
    1. To activate all available clusters, enable the Connect All Available Clusters toggle.
    2. To activate a single cluster, enable the toggle next to the cluster name. Multiple clusters can be enabled at the same time.
    3. To deactivate all clusters, disable the Connect All Available Clusters toggle.
    4. To deactivate a single cluster, disable the toggle next to the cluster name.

    Log in to the VMware vCenter and monitor the activation and deactivation of the cluster.

  6. Click Update Zone.

Creating an SSH public key pair (VMware vSphere)

Create a key pair to use SSH to log in to a virtual machine instance after it is deployed.

Procedure
  1. Create an SSH public key pair. From the command line of a workstation or PC accessible to the browser used to access HPE OneSphere, enter:
    ssh-keygen -t rsa -f cloud-key

    This command generates two files:

    • cloud-key, a private key you keep secret

    • cloud-key.pub, a public key you enter on the HPE OneSphere Virtual Machine panel

      You enter the public key when you deploy a virtual machine to the public cloud or private cloud.

  2. (Optional) Log in to the deployed virtual machine from the command line.
    ssh -i cloud-key username@vm-instance-ip-address

    You can also log in to the deployed virtual machine in HPE OneSphere. Under Projects, select a deployment, then click the Console icon.

    The console is launched if the proper routing and firewall rules are in place from the host to your local client.

Customizing a Windows virtual machine instance with cloudbase-init and sysprep

HPE OneSphere uses OpenStack software to deploy virtual machines. 

IMPORTANT:

Windows images must be prepared with cloud-init and sysprep in VMware vSphere before the images can be used by HPE OneSphere to deploy virtual machines to a VMware private cloud.

HPE suggests using cloudbase-init from Cloudbase Solutions to automate Windows guest operating system initialization.

The following procedure describes how to create and modify a Windows VM that you can use to create a template. The template will be automatically imported into the HPE OneSphere catalog when HPE OneSphere is connected to your VMware environment.

Procedure
  1. In VMware vSphere, create a new VM with a single virtual disk with sufficient storage and memory allocations.
  2. Deploy the Windows operating system in the VM.
  3. Install VMware Tools on the VM after Windows installation is complete.

    In the vSphere VM menu, select Guest, then Install/Upgrade VMware Tools.

  4. Install cloudbase-init on the virtual machine.
    1. Download the installer from https://cloudbase.it/cloudbase-init/#download.
    2. Run the installer.
    3. Enter a user name to create a user account in the "Administrators" group, for example, "Admin".
    4. Check the Use metadata password option.
    5. Click Next and wait until the installation completes.
    6. At the end of the installation, select the option to run the Sysprep package to create a generalized image.
    7. Click Finish to close the installer.
  5. (Optional) Modify the configuration settings of cloudbase-init.
    1. Open the file cloudbase-init.conf in an editor. The default location is C:Program Files (x86)Cloudbase SolutionsCloudbase-Initconfcloudbase-init.conf on the new VM.
    2. Modify the file with details specific to your environment. Following is an example cloudbase-init.conf file.

      See http://cloudbase-init.readthedocs.io/en/latest/userdata.html for more information.

      [DEFAULT]
      username=Admin
      groups=Administrators
      inject_user_password=true
      config_drive_raw_hhd=true
      config_drive_cdrom=true
      config_drive_vfat=true
      bsdtar_path=C:Program FilesCloudbase SolutionsCloudbase-Initbinbsdtar.exe
      mtools_path=C:Program FilesCloudbase SolutionsCloudbase-Initbin
      verbose=true
      debug=true
      logdir=C:Program FilesCloudbase SolutionsCloudbase-Initlog
      logfile=cloudbase-init.log
      default_log_levels=comtypes=INFO,suds=INFO,iso8601=WARN,requests=WARN
      logging_serial_port_settings=
      mtu_use_dhcp_config=true
      ntp_use_dhcp_config=true
      local_scripts_path=C:Program FilesCloudbase SolutionsCloudbase-InitLocalScripts
  6. Create a template from the VM. This template is imported into the HPE OneSphere Catalog, and can be selected when deploying virtual machines from your project in HPE OneSphere.

    See "Clone a Virtual Machine to a Template in the vSphere Web Client" in VMware Documentation.

Custom attributes on Microsoft Windows images

When a Windows image (VMDK file) is automatically uploaded to HPE OneSphere from your VMware vSphere environment, the OpenStack Glance service may populate incorrect values for your SCSI controller (vmware_adaptertype) and for your NIC type (hw_vif_model). Examine the output from the glance image-create command to verify the correct settings.

  • If you are using a virtual SCSI controller, the vmware_adaptertype property might be incorrectly set to lsiLogic instead of lsiLogicsas. You can change the property using the command:

    glance image-update --property vmware_adaptertype=lsiLogicsas <vm-id>
  • If you did not specify a value for hw_vif_model, the default VirtualE1000 is used. For a Windows instance, use a Vmxnet3 virtual NIC (VirtualVmxnet3).

    glance image-update --property hw_vif_model=VirtualVmxnet3 <vm-id>

Following are the values of hw_vif_model for various adapter types.

Adapter Type

Value of hw_vif_model

E1000 (default)

VirtualE1000

E1000e

VirtualE1000e

Flexible

VirtualPCNet32

Vmxnet

VirtualVmxnet

Vmxnet3

VirtualVmxnet3

For more information, see Create or update an image (glance) and Images with VMware vSphere from OpenStack Documentation.

Deploying a Kubernetes cluster to the private cloud

Use the following procedure to deploy a Kubernetes cluster in a VMware vSphere private cloud. Creating a cluster takes approximately 20-25 minutes.

NOTE:

  • Kubernetes clusters will not be provisioned on vSphere Standard Switch (vSwitch)-based VMware zones.

  • Kubernetes on VMware uses only static IPAM, which is managed by OpenStack Neutron.

  • Kubernetes on VMware does not support provider DHCP networks.

See also Launching a Kubernetes cluster dashboard.

Prerequisites

The administrator:

Procedure
  1. From the HPE OneSphere main menu, click Projects.

    (Administrator users can click Catalog, and skip steps 2, 3, and 4.).

  2. Click the project created, which you want to deploy the Kubernetes cluster.
  3. On the Project screen, click Deployments.

    Members of the selected project can view and manage the cluster after it is deployed.

  4. Click the plus sign  to the right of the Deployments. The Catalog screen appears.
  5. Browse or search the catalog for a Kubernetes Cluster service from the HPE Catalog, or filter the catalog items and check HPE Catalog
  6. Click the three dots in the lower right corner of the catalog item, then select Deploy
    If you selected the item, deselect it to see the three dots.
  7. On the Deploy panel: 
    1. Enter a Name for the new Kubernetes cluster.

      NOTE:

      The cluster name can consist of lowercase, numeric, and hyphen characters. Do not specify restricted characters <>={}(),";& in the cluster name.

    2. From the Project drop-down list, select a project into which to deploy the Kubernetes cluster.
    3. From the Region drop-down list, select a region into which to deploy the Kubernetes cluster.
    4. From the Zone drop-down menu, select a zone into which to deploy the Kubernetes cluster.
    5. From the Image drop-down, select the image. The images that are created in vCenter are listed here. See Creating an Ubuntu 16.04 virtual machine image with cloud-init in a VMware vSphere environment.
    6. From the Virtual Machine Profile drop-down, select the predefined flavor.

       HPE recommends using m1.large or higher. Select a larger flavor if the cluster is expected to host a large container or many smaller containers. The cluster can be scaled out to increase capacity for a large number of small containers, but the size of the hosts is fixed.

      By default, worker nodes have the same flavor as the cluster node. Select the appropriate flavor for the cluster node to match the load on the worker nodes.

    7. Under SSH Public Key, paste a key into the text box.

      Public SSH keys are usually located at ~/.ssh/id_rsa.pub.

      See Creating an SSH public key pair.

    8. Configure Worker nodes.

      The system deploys a highly available load balancer on two worker nodes, so at least two worker nodes are required. You can add a maximum of 20 worker nodes. 

      Kubernetes provides mechanisms to influence scheduling of workloads deployed at run time. In Kubernetes, taints are used to prevent workloads from running on master nodes. Taints can be overridden by adding tolerations to workloads. See Kubernetes Documentation for more information.

      NOTE:

      You can also edit the number of worker nodes after the Kubernetes cluster is deployed. See Updating the number of worker nodes in a Kubernetes cluster.

  8. Select the Network from the drop-down list.
  9. Click Customize Deployment to provide the proxy details.
  10. Click Deploy.  A screen with the status of the deployment is displayed.

The cluster is deployed with one master node and two worker nodes by default. When a Kubernetes cluster is deployed, a zone with the same name as the Kubernetes cluster is created in the private cloud region.

External load balancer capabilities are built into Kubernetes clusters that are deployed to the private cloud.

You can view the details of the created cluster in Projects.

Updating the number of worker nodes in a Kubernetes cluster 

Prerequisites
  • The administrator or consumer deployed a Kubernetes cluster.

Procedure
  1. From the HPE OneSphere main menu, click Projects.
  2. On the Projects screen, click the project name into which the Kubernetes cluster was deployed.
  3. On the selected project screen, click Deployments.
  4. On the Deployments screen, click the Kubernetes cluster.
  5. Click the Update Deployment link below the cluster name to display the Update Deployment panel.
  6. On the Update Deployment panel, enter the number of worker nodes or click the double-headed arrow to increase or decrease the worker nodes.

    NOTE:

    The virtual machine profile of the worker nodes cannot be changed. It is set to match the virtual machine profile configured for the Kubernetes cluster nodes.

  7. Click Update Deployment.

    NOTE:

    You can configure a maximum of 20 worker nodes.

    Decreasing the number of worker nodes may impact the external load balancer service if the node removed is running that service. 

Deploying a Kubernetes container application to the private cloud

Use the following procedure to deploy a Docker image or a Helm chart to a Kubernetes cluster in a vSphere private cloud.

Docker images and Helm charts can be included in a public or private catalog.

After a container application is deployed, you can optionally update the application to a newer version.

Prerequisites

The administrator:

Procedure
  1. From the HPE OneSphere main menu, click Projects.

    (Administrator users can click Catalog, and skip steps 2,3, and 4.)

  2. Click a project where you want to deploy the Kubernetes container application.
  3. On the Project screen, click Deployments.

    Members of the selected project can view and manage the cluster after it is deployed.

  4. Click the plus sign  to the right of the Deployments. The Catalog screen opens.
  5. Browse or search the catalog for a Kubernetes container image labeled Docker Hub, Docker Registry, Docker Hub Trusted RegistryPrivate Docker Hub, or Kubernetes Apps, or filter the results to show only these catalogs.

    The image will be deployed to the selected project.

  6. Click the three dots in the lower right corner of the catalog item, then select Deploy.
    If you selected the item, deselect it to see the three dots.
  7. On the Deploy panel:
    1. Enter a Name for the Kubernetes container.

      NOTE:

      The container name can consist of lowercase, numeric, and hyphen characters.

      Do not specify restricted characters <>={}(),";& in the container name.

    2. From the Project drop-down menu, select a project into which to deploy the Kubernetes container.
    3. From the Zone drop-down menu, select a zone containing a previously deployed Kubernetes cluster.
    4. (Optional) From the Version drop-down menu, select the latest version to deploy the Kubernetes container. If you do not select a version, by default the latest version (the first version listed in the drop-down list) is installed.
    5. (Optional) Enter User Data.

      To access the service (Helm Chart, Kubernetes App, or Docker Hub) externally from the provider network, specify the service type as a load balancer in the User Data field.

    6. If you have selected the image from Docker Hub in the Catalog, enter the Service Input.

      These ports are opened on the container for incoming (ingress) traffic.

      NOTE:

      For information about the application that can help you determine the User Data and Service Input to enter, select the Docker Hub or Helm Chart on the Catalog screen, then click the Detailed Description link under the application name.

  8. Click Deploy.

    The deployment of a Kubernetes container takes approximately two minutes.

    After the container is deployed, you can view the details of the created container in your project.

Updating a Kubernetes application deployment 

After a Docker Hub or Helm Chart application is deployed to a Kubernetes cluster, you can update the application to a newer version.

Prerequisites
  • The administrator or consumer deployed an application to a Kubernetes cluster.

Procedure
  1. From the HPE OneSphere main menu, click Projects.
  2. On the Projects screen, click the project name into which the Docker Hub or Helm Chart was deployed.
  3. On the selected project screen, click Deployments.
  4. On the Deployments screen, select the Docker Hub or Helm Chart deployment you want to update.
  5. Click the Update Deployment link below the deployment name. The Update Deployment panel is displayed.
  6. On the Update Deployment panel:
    1. Click the down arrow next to Version, and select a new version for your deployment.
    2. (Optional) Enter User Data.
    3. (Optional) If you selected the image from Docker Hub in the Catalog, enter Service Input.

      These ports are opened on the container for incoming (ingress) traffic.

      NOTE:

      For information about the application that can help you determine the User Data and Service Input to enter, select the application on the Catalog screen, then click the Detailed Description link under the application name.

  7. Click Update Deployment.