Use the SDDC Manager API to delete the Edge (already deleted via NSX) from VCF inventory
search cancel

Use the SDDC Manager API to delete the Edge (already deleted via NSX) from VCF inventory

book

Article ID: 373483

calendar_today

Updated On:

Products

VMware SDDC Manager / VCF Installer

Issue/Introduction

In certain scenarios, an NSX Edge node may experience a failure or require out-of-band manual intervention directly from the NSX Manager interface.

While modifying components outside of VMware Cloud Foundation (VCF) workflows is strongly discouraged, deleting an Edge node directly from NSX leaves a stale, orphaned node reference within the SDDC Manager inventory.

As a result, attempting to shrink the Edge cluster using the SDDC Manager UI (reference Remove Edge Nodes from an NSX Edge Cluster) fails with the following error:

Validation for edge cluster spec failing. Please check the table for details, when shrinking an NSX Edge node cluster

Cause

This issue occurs because the SDDC Manager database retains a reference to the deleted NSX Edge node. Because the node was removed out-of-band directly in NSX-T rather than through the automated SDDC Manager workflows, the SDDC inventory becomes desynchronized from the actual NSX inventory.

Resolution

  1. Take a snapshot of SDDC Manager VM
  2. SSH to SDDC Manager with vcf user and su to root
  3. Get the NSX-T Edge cluster ID

    psql -h localhost -U postgres -d platform -c "select * from nsxt_edge_cluster where name='<edge cluster name>'"

  4. Get the detail of the selected Edge cluster. The API returns the list of 1 Edge cluster.

    curl localhost/inventory/nsxt-edgeclusters?id=<ID from step #3> | json_pp

    Sample Output

    curl localhost/inventory/nsxt-edgeclusters?id=<ID from step #3> | json_pp
    [
       {
          "clusterIds" : [
             "UUI"
          ],
          "edgeClusterNsxtId" : "##",
          "id" : "##",
          "isTier0ManagedBySystem" : true,
          "name" : "<Cluster_name>",
          "nsxtClusterId" : "##",
          "nsxtEdgeNodes" : [
             {
                "edgeNodeNsxtId" : "##",
                "hostName" : "en01.example.com",
                "id" : "###",
                "managementIpAddress" : "#.#.#.#"
             },
             {
                "edgeNodeNsxtId" : "##",
                "hostName" : "en02.example.com",
                "id" : "##",
                "managementIpAddress" : "#.#.#.#"
             },
             {
                "edgeNodeNsxtId" : "##",
                "hostName" : "en03.example.com",
                "id" : "##",
                "managementIpAddress" : "#.#.#.#"
             }
          ],
          "originType" : "CLASSIC",
          "skipTepRoutabilityCheck" : false,
          "status" : "ACTIVE"
       }
    ]
  5. To delete the Edge ("hostName" : "Edge-Node-3-FQDN"), prepare the Edge cluster spec with the Edge which needs to be deleted from VCF Inventory.
    • Referencing the output from Step 4 and delete the selected Edge information (I.e."hostName" : "Edge-Node-3-FQDN")
    • Note that the API response in Step 4 is the list.
    • Build the "proper payload" - a file based on the result from the command above.

  6. From the output in Step 4, remove the brackets "[]" and the string that refers to Edge-Node-3-FQDN  [below are 2 examples with strikethroughs - i.e. what to remove].

    Original response

    [
       {
          "clusterIds" : [
             "UUI"
          ],
          "edgeClusterNsxtId" : "##",
          "id" : "##",
          "isTier0ManagedBySystem" : true,
          "name" : "<Cluster_name>",
          "nsxtClusterId" : "#",
          "nsxtEdgeNodes" : [
             {
                "edgeNodeNsxtId" : "##",
                "hostName" : "en01.example.com",
                "id" : "##",
                "managementIpAddress" : "#.#.#.#"
             },
             {
                "edgeNodeNsxtId" : "##",
                "hostName" : "en02.example.com",
                "id" : "##",
                "managementIpAddress" : "#.#.#.#"
             },
             {
                "edgeNodeNsxtId" : "##",
                "hostName" : "en03.example.com",
                "id" : "##",
                "managementIpAddress" : "#.#.#.#"
             }
          ],
          "originType" : "CLASSIC",
          "skipTepRoutabilityCheck" : false,
          "status" : "ACTIVE"
       }
    ]

    Proper payload json file after removing Edge-Node-3

    vi ec.json

    {
          "clusterIds" : [
             "UUI"
          ],
          "edgeClusterNsxtId" : "##",
          "id" : "##",
          "isTier0ManagedBySystem" : true,
          "name" : "<Cluster_name>",
          "nsxtClusterId" : "##",
          "nsxtEdgeNodes" : [
             {
                "edgeNodeNsxtId" : "##",
                "hostName" : "en01.example.com",
                "id" : "##",
                "managementIpAddress" : "#.#.#.#"
             },
             {
                "edgeNodeNsxtId" : "##",
                "hostName" : "en02.example.com",
                "id" : "##",
                "managementIpAddress" : "#.#.#.#"
             }
            ],
          "originType" : "CLASSIC",
          "skipTepRoutabilityCheck" : false,
          "status" : "ACTIVE"
       }
    


  7. Use the SDDC Manager API to update the Edge cluster without the Edge which needs to be deleted from VCF Inventory.

    curl localhost/inventory/nsxt-edgeclusters/<nsxt edge cluster id from step #3 >  -X PUT -H 'Content-Type: application/json' -d @ec.json | json_pp

  8. Check the psql or SDDC Manager web console to verify that the deleted edge is not present.

    curl localhost/inventory/nsxt-edgeclusters?id=<ID from step #3> | json_pp

  9. Once the Edge is removed form the VCF inventory, use the VCF Day N Operation (Edge Cluster Expansion) to deploy additional Edge(s) - refer to Add Edge Nodes to an NSX Edge Cluster

    Note: The API doesn't impact the NSX manager, it just removes cluster membership.