使用 API 將 NSX Manager 設定為要將控制器自動安裝在 vCenter Server 所管理的 vSphere ESXi 主機上。控制器安裝好之後,便會自動新增至 vSphere ESXi 主機上的控制器叢集。

程序

  1. 觸發控制器叢集的自動建立程序之前,您必須根據 POST API 的裝載需求,擷取 vCenter Server 識別碼、計算識別碼、儲存區識別碼和網路識別碼。
  2. 登入 vCenter Server

    https://<vCenterServer_IPAddress>/mob.

  3. 在 [值] 資料行中,按一下內容
  4. 在 [內容屬性] 頁面中,前往 [值] 資料行以搜尋資料中心,然後按一下群組連結。
  5. 在 [群組內容] 頁面中,前往 [值] 資料行,然後按一下資料中心連結。
  6. 在 [資料中心內容] 頁面中,複製您要用來建立控制器叢集的資料存放區值和網路值。
  7. 按一下 HostFolder 連結。
  8. 在 [群組內容] 頁面中,複製您要用來建立控制器叢集的叢集值。
  9. 若要擷取 vCenter Server 識別碼,請前往 NSX Manager UI,並從 [計算管理程式] 頁面中複製其識別碼。
  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