Recently, I ran into an interesting problem in my lab where I couldn’t get rid of an unused Virtual Service in NSX ALB. The attempt to delete was failing with an error: “VS cannot be deleted! ‘It is being referred to by SystemConfiguration object”
I tried deleting the VS via API and it returned the same error
1 2 3 4 5 6 7 |
DELETE https://siteb-alb.sddc.lab/api/virtualservice/virtualservice-68679e6f-f10b-45ee-ab7d-d714ff8766aa Response: { "error": "siteb-local-dns-vs cannot be deleted! 'siteb-local-dns-vs' is being referred to by SystemConfiguration object" } |
To figure out where this VS is being referenced, I looked through the pool members and other settings in NSX ALB, but I couldn’t discover anything particular. Internet searches were also not very helpful.
I then checked this issue in internal tools and got a hint that I needed to remove the VS reference from the system configuration through API first.
The procedure to do so is given below.
1: Fetch NSX ALB System Configuration
1 2 3 |
Method: GET URL: https://{{alb_url}}/api/systemconfiguration |
In the response body of the above API call, you will get a reference to the DNS VS. Look for the field “dns_virtualservice_refs”
I have attached a sample response here just for reference.
2: Update NSX ALB System Configuration
Take the response output and change the dns_virtualservice_refs to blank.
For an example payload, refer to the screenshot below.
1 2 3 |
Method: PUT URL: https://{{alb_url}}/api/systemconfiguration |
Switch back to the NSX ALB UI and delete the VS. It should be deleted without any further hiccups.
I hope you enjoyed reading this post. Feel free to share this on social media if it is worth sharing.