Avi/NSX ALB: Deleting httppolicyset via CLI
VMware NSX Advanced Load Balancer – also known as AVI Vantage – is a very comprehensive load balancer I was implementing in my lab the last days.
The context
By default AVI Controller creates one HTTP-Policy-Set per Virtual Service by default and can be managed via UI. However the UI does not allow to create multiple ones, but still multiple sets are indeed supported. The only caveat is that they can only be created/deleted via CLI/API only.
As part of some troubleshooting an automatism created an additional HTTP-Policy-Set, but did not remove it. Hence having one additional HTTP-Policy-Set stuck on my virtual service.
The "issue"
When trying to delete it via CLI, you might end up with:
[admin:avicontroller]: > delete httppolicyset Test-LetsEncryptHTTPpolicy
{"error": "Cannot delete, object is referred by: ['VirtualService TestWeb']", "obj_name": "Test-LetsEncryptHTTPpolicy"}
[admin:avicontroller]: >
The solution
To delete additional HTTP-Policy-Sets do the following:
-
Connect to the AVI Controller via SSH
-
Open the custom shell by typing
shell
and logging in -
Configure the virtualservice by switching into the
virtualservice
context:[admin:avicontroller]: > configure virtualservice TestWeb Updating an existing object. Currently, the object is: +------------------------------------+-----------------------------------------------------+ | Field | Value | +------------------------------------+-----------------------------------------------------+ | uuid | virtualservice-56b7eb0c-5044-4700-a217-3784a6f0d397 | | name | TestWeb | [...]
-
De-reference the
httppolicyset
andexit
the context by using:[admin:avicontroller]: virtualservice> no http_policies index 1 Removed http_policies with index 1 [admin:avicontroller]: virtualservice> exit +------------------------------------+-----------------------------------------------------+ | Field | Value | [...]
-
List all HTTP-Policies-Sets by using the auto-completion via tab:
[admin:avicontroller]: > delete httppolicyset[tab] Test-LetsEncryptHTTPpolicy
-
Finally delete the
httppolicyset
by using:[admin:avicontroller]: > delete httppolicyset Test-LetsEncryptHTTPpolicy Successfully deleted Test-LetsEncryptHTTPpolicy.
All done!