You can remove a cluster from Tanzu Service Mesh by using the Tanzu Service Mesh API. Removing a cluster involves removing the cluster-related objects from the Tanzu Service Mesh Global Controller (the control plane) and deleting the Tanzu Service Mesh agent components from the cluster.
To remove a cluster from Tanzu Service Mesh, perform the following steps.
Prerequisites
Get an API token and an access code to authenticate your requests to the Tanzu Service Mesh API. You must use the access code in the csp-auth-token header in your requests. For information about generating an API token and getting an access code, see Authentication with the Tanzu Service Mesh REST API.
Procedure
- Submit the following request.
DELETE https://{server_name}/tsm/v1alpha2/projects/default/clusters/{cluster_id}
Where {cluster_id}
is the identifier of your cluster, and {server_name}
is the name of the Tanzu Service Mesh server.
The response contains the ID of the job that was created to remove the cluster objects from the Tanzu Service Mesh Global Controller. The job will be running in the background.
- To get the status of the job, submit the following request.
GET https://{server_name}/tsm/v1alpha2/projects/default/jobs/{id}
Where {id}
is the job ID returned in step 1.
The state
field in the response contains the status of the job. If the job has finished removing the cluster objects, the state
is Completed
.
Note:
If the state
is Started
, the job is still running. Wait a few minutes and then resend the request.
If a status other than Started
or Completed
is returned for the job, a problem occurred. Contact VMware Support.
- Submit the following request:
GET https://{server_name}/tsm/v1alpha2/projects/default/jobs/{id}/download
Where {id}
is the ID of the job returned in step 1.
Important:
Submit this request only after a request to GET https://{server_name}/tsm/v1alpha2/projects/default/jobs/{id} returns a state
of Completed
.
The response contains the URL of the registration YAML file for the cluster in the format https://{server_name}/cluster-registration/k8s/operator-deployment.yaml.
- To remove the Tanzu Service Mesh agent components from the cluster, run the following command:
kubectl --context {cluster_name} delete -f {url}
Where {cluster_name}
is the name of the cluster, {server_name}
is the name of the Tanzu Service Mesh server, {url}
is the URL of the registration YAML that was returned in step 3.
Results
The cluster is removed from Tanzu Service Mesh, and the information about the cluster no longer appears in the Tanzu Service Mesh Console user interface.