通过使用 API,可以将 NSX Manager 配置为在 vCenter Server 管理的 vSphere ESXi 主机上自动安装控制器。在安装控制器后,它们将自动添加到 vSphere ESXi 主机上的控制器群集中。

过程

  1. 在触发自动创建控制器群集的过程之前,您必须获取所需的 vCenter Server ID、计算 ID、存储 ID 和网络 ID 以作为 POST API 负载。
  2. 登录到 vCenter Server

    https://<vCenterServer_IPAddress>/mob.

  3. 在“值”列中,单击内容
  4. 在“内容属性”页面中,转到“值”列,搜索数据中心,然后单击组链接。
  5. 在“组属性”页面中,转到“值”列,然后单击数据中心链接。
  6. 在“数据中心属性”页面中,复制要用于创建控制器群集的数据存储值和网络值。
  7. 单击 HostFolder 链接。
  8. 在“组属性”页面上,复制要用于创建控制器群集的群集值。
  9. 要获取 vCenter Server ID,请转至 NSX Manager UI,然后从“计算管理器”页面复制其 ID。
  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. 您可以使用 API 调用查看部署状态。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", 
        } 
      ] 
    
    } 

下一步做什么

删除群集。请参见删除 NSX Controller