Recently I deployed an edge cluster in my lab for NSX-T based workload domain. In VCF 4.0, a new feature was added for automated deployment of edge cluster. If you haven’t tried this yet, you can follow my previous Post to learn more about this.
My edge cluster encountered some routing issues because of incorrect BGP information passed during edge cluster deployment workflow and I was looking for how to remove it cleanly from sddc manager.
While searching on internet, I came across VMware KB-78635 which lists the instructions of doing so. In this post I will walk through steps from the above KB.
Edge Cluster removal workflow is not baked into sddc manager yet and is carried out by python scripts provided by VMware. May be in next release of VCF, we will see this option added to sddc manager 😉
Edge cluster python script is named “edge_cluster_cleaner” and you will find this script as tar file in attachment section of KB-78635.
You then need to upload the tar ball to sddc manager via winscp or similar utility and unzip the tar file to get the executable python scripts.
Few things to know before using edge cluster cleaner tool
1: This tool can only run from sddc manager. You can’t invoke this script just from any other machine where python is installed.
2: This tool works on edge clusters created either by an AVN bringup workflow (during management wld creation) or by an SDDC Manager edge cluster creation workflow. If you have deployed edge cluster directly from NSX-T administration portal, this tool won’t be able to clean that.
3: During edge cluster deletion, T0 & T1 gateways are removed. But if you have configured any additional services/settings (outside of edge cluster creation workflow), then the cleaner script will fail stating clear reason for failure.
In my environment, I had added couple of IP Prefixes on T0 gateway and script failed to remove that. I had to manually delete those prefixes befor invoking tool again.
4: Any name changes made to the fabric or logical entities deployed by the SDDC Manager Edge Cluster workflow should be reverted to their original names.
5: If you have deployed any WCP and related components on top of edge cluster created by sddc manager, you need to delete them before invoking the cleaner tool.
How To Use Edge Cluster Cleaner Tool?
Edge cleaner tool requires SSO credentials of the workload domain where edge cluster was deployed. You can supply sso credentials via exporting environment variables temporarily or specifying in ~/.bashrc file of sddc manager.
Note: To run this tool, you need to switch to root user on sddc manager.
You need to export below environment variables:
1 2 3 |
export SDDC_SSO_USERNAME=administrator@vsphere.local export SDDC_SSO_PASSWORD=VMware1! |
You can invoke edge cluster cleaner tool with –help parameter to see various options available.
To start removing the edge cluster, we will run below command:
# remove_edge_cluster.sh –cluster <edge_cluster_name>
And the magic begins 😉
Troubleshooting Note:
Before I wrap up this post, I wanna highlight one issue that I encountered with this tool.
There are 2 scripts provided with this tool for edge cluster cleanup as shown in below screenshot.
If you invoke the script with .py extension, it is likely to fail with below error:
1 2 3 4 5 6 7 8 9 |
root@sddc-manager [ ~/cleanup ]# ./edge_cluster_cleaner.py --dryrun Traceback (most recent call last): File "./edge_cluster_cleaner.py", line 28, in <module> from vc_connection import VcConnection File "/root/cleanup/vc_connection.py", line 12, in <module> from tasks import wait_for_tasks File "/root/cleanup/tasks.py", line 12, in <module> from pyVmomi import vim ModuleNotFoundError: No module named 'pyVmomi' |
This issue can be fixed by installing “pyVmomi” python module using below command:
# pip3 install –upgrade pyvmomi
To avoid this situation, use the remove_edge_cluster.sh script.
And that’s it for this post.
I hope you enjoyed reading this post. Feel free to share this on social media if it is worth sharing 🙂