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

Issue/Introduction

  • There are some scenarios where Edge nodes can fail and/ or need manual intervention from an NSX perspective.
  • These changes are not always recommended, that being said, if an action was performed on an NSX-T Edge cluster, without SDDC intervention we'll get stuck with a node reference on SDDC side only.
  • Shrinking the Cluster via GUI via Remove Edge Nodes from an NSX Edge Cluster will fail with below error
    Validation for edge cluster spec failing. please check the table for details, when shrinking an NSX Edge node cluster

Environment

VMware Cloud Foundation

Cause

There are some scenarios where NSX edge nodes are manually removed from Cluster, without SDDC involvement. 
Such cases should be avoided, but in case that occurs we can update the NSX-T edge cluster membership

Resolution

  1. Take the snapshot of SDDC Manager VM
  2. SSH to SDDC Manager with vcf user and su to root
  3. Get the NSXT 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 tep #> | json_pp
    [
       {
          "clusterIds" : [
             "UUI"
          ],
          "edgeClusterNsxtId" : "xxxxxxxxxxxxxxxxxxxxx",
          "id" : "aaaaaaaaaaaa",
          "isTier0ManagedBySystem" : true,
          "name" : "<Cluster_name>",
          "nsxtClusterId" : "yyyyyyyyyyyyyyyy",
          "nsxtEdgeNodes" : [
             {
                "edgeNodeNsxtId" : "bbbbbbbbbbbbbbbbb",
                "hostName" : "en01.example.com",
                "id" : "ccccccccccccccccccccc",
                "managementIpAddress" : "xx.xx.xx.xx"
             },
             {
                "edgeNodeNsxtId" : "ddddddddddddddddddddddddd",
                "hostName" : "en02.example.com",
                "id" : "eeeeeeeeeeeeeeeeeeee",
                "managementIpAddress" : "yy.yy.yy.yy"
             },
             {
                "edgeNodeNsxtId" : "ffffffffffffffffffffffffffffffffffffff",
                "hostName" : "en03.example.com",
                "id" : "zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz",
                "managementIpAddress" : "zz.zz.zz.zz"
             }
          ],
          "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 need to be deleted from VCF Inventory.
    • Refer the response 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", basically a file based on the result from the command above.

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

    Original response

    [
       {
          "clusterIds" : [
             "UUI"
          ],
          "edgeClusterNsxtId" : "xxxxxxxxxxxxxxxxxxxxx",
          "id" : "aaaaaaaaaaaa",
          "isTier0ManagedBySystem" : true,
          "name" : "<Cluster_name>",
          "nsxtClusterId" : "yyyyyyyyyyyyyyyy",
          "nsxtEdgeNodes" : [
             {
                "edgeNodeNsxtId" : "bbbbbbbbbbbbbbbbb",
                "hostName" : "en01.example.com",
                "id" : "ccccccccccccccccccccc",
                "managementIpAddress" : "xx.xx.xx.xx"
             },
             {
                "edgeNodeNsxtId" : "ddddddddddddddddddddddddd",
                "hostName" : "en02.example.com",
                "id" : "eeeeeeeeeeeeeeeeeeee",
                "managementIpAddress" : "yy.yy.yy.yy"
             },
             {
                "edgeNodeNsxtId" : "ffffffffffffffffffffffffffffffffffffff",
                "hostName" : "en03.example.com",
                "id" : "zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz",
                "managementIpAddress" : "zz.zz.zz.zz"
             }
          ],
          "originType" : "CLASSIC",
          "skipTepRoutabilityCheck" : false,
          "status" : "ACTIVE"
       }
    ]

    Proper payload Json file after removing Edge-Node-3
    vi ec.json

     

    {
          "clusterIds" : [
             "UUI"
          ],
          "edgeClusterNsxtId" : "xxxxxxxxxxxxxxxxxxxxx",
          "id" : "aaaaaaaaaaaa",
          "isTier0ManagedBySystem" : true,
          "name" : "<Cluster_name>",
          "nsxtClusterId" : "yyyyyyyyyyyyyyyy",
          "nsxtEdgeNodes" : [
             {
                "edgeNodeNsxtId" : "bbbbbbbbbbbbbbbbb",
                "hostName" : "en01.example.com",
                "id" : "ccccccccccccccccccccc",
                "managementIpAddress" : "xx.xx.xx.xx"
             },
             {
                "edgeNodeNsxtId" : "ddddddddddddddddddddddddd",
                "hostName" : "en02.example.com",
                "id" : "eeeeeeeeeeeeeeeeeeee",
                "managementIpAddress" : "yy.yy.yy.yy"
             }
            ],
          "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 Edge is removed form the VCF Inventory, use the VCF Day N Operation (Edge Cluster Expansion) to deploy additional Edge(s) - Refer Add Edge Nodes to an NSX Edge Cluster

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