Using APIs configure NSX Manager to install controllers automatically on vSphere ESXi hosts managed by a vCenter Server. After controllers are installed, they are automatically added to a controller cluster on vSphere ESXi hosts.

Procedure

  1. Before you trigger the automatic creation of the controller cluster, you must fetch the vCenter Server ID, compute ID, storage ID, and network ID required as the payload of the POST API.
  2. Log in to the vCenter Server.

    https://<vCenterServer_IPAddress>/mob.

  3. In the Value column, click Content.
  4. In the Content properties page, go to the Value column search for data center, and click the group link.
  5. In the Group properties page, go to the Value column, and click the data center link.
  6. In the Data Center properties page, copy the datastore value, network value that you want to use to create the controller cluster.
  7. Click the HostFolder link.
  8. In the Group properties page, copy the cluster value that you want to use to create the controller cluster.
  9. To fetch the vCenter Server ID, go to the NSX Manager UI and copy its ID from the Compute Manager page.
  10. POST https://<nsx-manager>/api/v1/cluster/nodes/deployments
    REQUEST 
    { 
      "deployment_requests": [ 
        { 
          "roles": ["CONTROLLER"], 
            "user_settings": { 
            "cli_password": "CLIp4$$w4rd", 
            "root_password": "ROOTp4$$w4rd" 
          }, 
          "deployment_config": { 
            "placement_type": "VsphereClusterNodeVMDeploymentConfig", 
            "vc_id": "69874c95-51ed-4775-bba8-e0d13bdb4fed", 
            "management_network_id": "network-13", 
            "hostname": "controller-0", 
            "compute_id": "domain-s9", 
            "storage_id": "datastore-12", 
            "default_gateway_addresses":[ 
            "10.33.79.253" 
            ], 
            "management_port_subnets":[ 
              { 
               "ip_addresses":[ 
               "10.33.79.64" 
               ], 
                "prefix_length":"22" 
              } 
            ] 
          } 
        }, 
        { 
          "roles": ["CONTROLLER"], 
            "user_settings": { 
            "cli_password": "VMware$123", 
            "root_password": "VMware$123" 
          }, 
    
          "deployment_config": { 
            "placement_type": "VsphereClusterNodeVMDeploymentConfig", 
            "vc_id": "69874c95-51ed-4775-bba8-e0d13bdb4fed", 
            "management_network_id": "network-13", 
            "hostname": "controller-1", 
            "compute_id": "domain-s9", 
            "storage_id": "datastore-12" 
            "default_gateway_addresses":[ 
             "10.33.79.253" 
            ], 
           "management_port_subnets":[ 
              { 
                "ip_addresses":[ 
                  "10.33.79.65" 
                ], 
                "prefix_length":"22" 
              } 
            ] 
          }  
        } 
      ], 
    						"deployment_config": { 
          "placement_type": "VsphereClusterNodeVMDeploymentConfig", 
          "vc_id": "69874c95-51ed-4775-bba8-e0d13bdb4fed", 
          "management_network_id": "network-13", 
          "hostname": "controller-0", 
          "compute_id": "domain-s9", 
          "storage_id": "datastore-12", 
          "default_gateway_addresses":[ 
          "10.33.79.253" 
           ], 
          "management_port_subnets":[ 
           { 
            "ip_addresses":[ 
            "10.33.79.66" 
             ], 
            "prefix_length":"22" 
              } 
            ] 
          } 
        }, 
      
    		"clustering_config": { 
        "clustering_type": "ControlClusteringConfig", 
        "shared_secret": "123456", 
        "join_to_existing_cluster": false 
      } 
    } 
    
    Response 
    { 
      "result_count": 2, 
      "results": [ 
        { 
          "user_settings": { 
            "cli_password": "[redacted]", 
            "root_password": "[redacted]", 
            "cli_username": "admin" 
          }, 
          "vm_id": "71f02260-644f-4482-aa9a-ab8570bb49a3", 
          "roles": [ 
            "CONTROLLER" 
          ], 
          "deployment_config": { 
            "placement_type": "VsphereClusterNodeVMDeploymentConfig", 
            "vc_id": "69874c95-51ed-4775-bba8-e0d13bdb4fed", 
            "management_network_id": "network-13", 
            "default_gateway_addresses": [ 
              "10.33.79.253" 
            ], 
            "hostname": "controller-0", 
            "compute_id": "domain-s9", 
            "storage_id": "datastore-12", 
            "management_port_subnets": [ 
              { 
                "ip_addresses": [ 
                  "10.33.79.64" 
                ], 
               "prefix_length": 22 
              } 
            ] 
          }, 
    
          "form_factor": "SMALL" 
        }, 
    
        { 
          "user_settings": { 
            "cli_password": "[redacted]", 
            "root_password": "[redacted]", 
            "cli_username": "admin" 
          }, 
    
          "vm_id": "38029a2b-b9bc-467f-8138-aef784e802cc", 
          "roles": [ 
            "CONTROLLER" 
          ], 
          "deployment_config": { 
            "placement_type": "VsphereClusterNodeVMDeploymentConfig", 
            "vc_id": "69874c95-51ed-4775-bba8-e0d13bdb4fed", 
            "management_network_id": "network-13", 
            "hostname": "controller-1", 
            "compute_id": "domain-s9", 
            "storage_id": "datastore-12" 
          }, 
          "form_factor": "MEDIUM" 
        } 
      ] 
    } 
  11. You can view the status of deployment using the API call. GET https://<nsx-manager>/api/v1/cluster/nodes/deployments
    { 
    
      "result_count": 2, 
      "results": [ 
        { 
          "user_settings": { 
            "cli_password": "[redacted]", 
            "root_password": "[redacted]" 
          }, 
    	     "vm_id": "12f563af-af9f-48f3-848e-e9257c8740b0", 
          "roles": [ 
          "CONTROLLER" 
          ], 
    
          "deployment_config": { 
          "placement_type": "VsphereClusterNodeVMDeploymentConfig", 
          "vc_id": "15145422-47a1-4c55-81da-01d953151d1f", 
          "management_network_id": "network-158", 
          "hostname": "controller-0", 
          "compute_id": "domain-c154", 
          "storage_id": "datastore-157" 
          }, 
          "form_factor": "SMALL", 
        }, 
        { 
          "user_settings": { 
          "cli_password": "[redacted]", 
          "root_password": "[redacted]" 
          }, 
          "vm_id": "cc21854c-265b-42de-af5f-05448c00777a", 
          "roles": [ 
          "CONTROLLER" 
          ], 
          "deployment_config": { 
          "placement_type": "VsphereClusterNodeVMDeploymentConfig", 
          "vc_id": "feb17651-49a7-4ce6-88b4-41d3f624e53b", 
          "management_network_id": "network-158", 
          "hostname": "controller-0", 
          "compute_id": "domain-c154", 
          "storage_id": "datastore-157" 
          }, 
    
          "form_factor": "MEDIUM", 
        } 
      ] 
    
    } 

What to do next

Delete a cluster. See Delete controllers.