Skip to content
This repository has been archived by the owner on Jan 14, 2020. It is now read-only.

Working with ESXi Hosts

It4lik edited this page Jul 6, 2017 · 8 revisions

Here's how you to work with ESXi hosts. You can, for example, add ESXi hosts to your Photon Controller cluster. Adding ESXi hosts to the cluster can expand the cluster's capacity for computation and storage so that you can run more VMs or create larger Kubernetes clusters.

Adding an ESXi Host to a Photon Controller Cluster

Connect to the Photon Platform installer VM as root by using SSH; example:

ssh root@198.51.100.212

(The default password for the installer VM, if you haven't changed it, is changeme.)

The Photon Platform installer VM includes a command-line utility that you use to install the Photon Platform VIBs on an ESXi host that you want to add to a Photon cluster. Here's the help for the command to install the VIBS on an ESXi host so that you can add it:

/opt/vmware/photon/controller/bin/photon-setup agent help
Usage: photon-setup agent <command> <arguments>
Command:
    install
    help
agent install:
    -esxi_host      <ESXi hostname or IP Address>
    -esxi_password  <Password to ESXi host>
    -lw_domain      <Lightwave domain name>
    -lw_password    <Lightwave domain Administrator password>
    -lw_dns         <Lightwave preferred DNS>
    -syslog_server  <Syslog endpoint>

Here's an example of the command to install the VIBs on an ESXi host:

/opt/vmware/photon/controller/bin/photon-setup agent install
-esxi_host 192.0.2.23
-esxi_password  Secret1!
-lw_domain      lightwave-1.example.com
-lw_password    TopSecret!
-lw_dns         198.51.100.1

After you install the VIBs, you can terminate your SSH connection to the installer VM and use the Photon CLI on your workstation to add the ESXi host to the cluster by using the photon host create command:

photon host create --username root --password ESXiHostPw --address <ip-address-of-new-ESXi-host>

Here's the usage information the photon host create command:

photon host create -h
NAME:
   photon host create - Add a new host

USAGE:
   photon host create [command options]  

DESCRIPTION:
   Add a new host to Photon Controller. You must a system administrator to add a host.

OPTIONS:
   --username value, -u value           username to create host
   --password value, -p value           password to create host
   --address value, -i value            ip address of the host
   --availability_zone value, -z value  availability zone of the host
   --tag value, -t value                tag for the host (MGMT and/or CLOUD)
   --metadata value, -m value           metadata for the host 

Metadata values need to provided in the following form (use double-quotes only) :

{"MANAGEMENT_DATASTORE":"<datastore_name>", "MANAGEMENT_NETWORK_DNS_SERVER":"<internal_dns_server>","MANAGEMENT_NETWORK_GATEWAY":"<net_gateway>","MANAGEMENT_NETWORK_IP":"<net_ip>",MANAGEMENT_NETWORK_NETMASK":"<net_netmask>", "MANAGEMENT_PORTGROUP":"<dedicated_host_portgroup>"}

If you want to specify metadatas, which is mandatory for a MGMT node, the best way to achieve it is to let the photon command prompts us to provide the required metadatas. Here is an example command with all the mandatory metadatas for a MGMT node :

$ photon host create --username root --password <host_pass> --address <host_ip_addr> --tag MGMT,CLOUD # Press Enter

Host Metadata ({'key':'value'}. required by host of 'MGMT' tag): {"MANAGEMENT_DATASTORE":"datastore1", "MANAGEMENT_NETWORK_DNS_SERVER":"193.51.196.130", "MANAGEMENT_NETWORK_GATEWAY":"128.93.130.100","MANAGEMENT_NETWORK_IP":"128.93.130.0", "MANAGEMENT_NETWORK_NETMASK":"255.255.255.0", "MANAGEMENT_PORTGROUP":"VM Network"}
CREATE_HOST completed for 'host' entity cea32cb3-6125-4498-b67c-9fb9eb06cb36                        

After you create the host, you must provision it with the photon host provision command so that it is in a ready state:

photon host provision -h
NAME:
   photon host provision - Provision host with given id

USAGE:
   photon host provision <host-id>

DESCRIPTION:
   Provision a host given its id. You must be a system administrator to do this.
   This will configure photon controller agent and make the host ready.

Viewing Information about ESXi Hosts

List the ESXi hosts in a Photon Controller cluster and show their status:

photon host list
ID                     State  IP             Tags
137d4e5a5437f85fea900  READY  198.51.100.44  MGMT CLOUD
Total: 1

Show complete information for a host by citing its ID:

photon host show 137d4e5a5437f85fea900
Host ID:  137d4e5a5437f85fea900
  Username:           root
  IP:                 198.51.100.44
  Tags:               [MGMT CLOUD]
  State:              READY
  Metadata:           map[MANAGEMENT_VM_DISK_GB_OVERWRITE:80 
                      MANAGEMENT_NETWORK_DNS_SERVER:198.51.98.1 
                      MANAGEMENT_NETWORK_NETMASK:255.255.0.0 
                      MANAGEMENT_NETWORK_IP:198.51.100.207 
                      MANAGEMENT_NETWORK_GATEWAY: 198.51.100.253 
                      MANAGEMENT_DATASTORE:datastore1 
                      MANAGEMENT_VM_CPU_COUNT_OVERWRITE:4 
                      MANAGEMENT_PORTGROUP:VM Network 
                      MANAGEMENT_VM_MEMORY_MB_OVERWRITE:6144]
  AvailabilityZone:   
  Version:            6.0.0

List the VMs on an ESXi host and show their state by citing the ID of the host:

photon host list-vms 137d4e5a5437f85fea900
ID                                    Name                                         State
1305ecbd-8717-4dad-bc4f-1e7b6cebb897  Photon-OS                                    STARTED
19d197fc-2653-466f-bb7f-5f03a5a6bdb1  ec-mgmt-10-118-100-448095e                   STARTED
1eba91ba-c926-41dc-adb1-4b82e0797c4b  master-7a0c629b-52dc-49c9-b58f-f37100948487  STARTED
71b20ca1-5055-4530-8218-e0ca0730e79d  worker-7daa6a2c-39f9-4834-be33-4ccac548f8da  STARTED
85c9325b-ed0f-4f63-8bd6-8c581d4593fa  etcd-96cae740-3c65-4ac8-96e9-c6b170990934    STARTED
ebce1024-1282-49d5-a4dc-930d40923d18  Photon-OS-2                                  STARTED
Total: 6
STARTED: 6

Show the tasks on a host:

photon host tasks 137d4e5a5437f85fea900
Task                   Start Time              Duration
137d4e5a5437f85fee398  2016-12-12 04:44:31.00  00:00:10
CREATE_HOST, COMPLETED
You can run 'photon task show <id>' for more information
Total: 1

There are additional commands for managing the ESXi hosts in a Photon Controller cluster:

photon host --help
NAME:
   photon host - options for host
USAGE:
   photon host command [command options] [arguments...]
COMMANDS:
   create			Create a new host
   delete			Delete a host with specified id
   list				List all the hosts
   show				Show host info with specified id
   list-vms			List all the vms on the host
   set-availability-zone	Set host's availability zone
   tasks			Show tenant tasks
   suspend			Suspend host with specified id
   resume			Resume host with specified id
   enter-maintenance		Host with specified id enter maintenance mode
   exit-maintenance		Host with specified id exit maintenance mode
   help, h			Shows a list of commands or help for one command
OPTIONS:
   --help, -h	show help
Clone this wiki locally