Attach a cluster to TMC and set the cluster group & custom labels using the tanzu cli
search cancel

Attach a cluster to TMC and set the cluster group & custom labels using the tanzu cli

book

Article ID: 378601

calendar_today

Updated On:

Products

VMware Tanzu Mission Control

Issue/Introduction

The 'tmc' cli has been deprecated.  The 'tanzu' cli with the 'mission-control' plugin should be used instead.  In the deprecated 'tmc' cli, while attaching a cluster using the 'tmc cluster attach' command, the flags '--cluster-group' and '--labels' can be used to set the cluster group and any custom labels.  In the new 'tanzu' cli, these specific flags are not available.

Environment

Tanzu Mission Control

Resolution

To set the cluster group and any custom labels while attaching using the 'tanzu' cli, follow these steps:

  1. Create a manifest YAML file that has the necessary information.  Below is an example YAML where cluster group and labels information are set.

    fullName:
      managementClusterName: attached
      name: testcluster
      provisionerName: attached
    meta:
      labels:
        cluster-name: testcluster-label
    spec:
      clusterGroupName: testclustergroup
    type:
      kind: Cluster
      package: vmware.tanzu.manage.v1alpha1.cluster
      version: v1alpha1
  2. Run the 'tanzu' command to attach a cluster.  Make sure to use the valid kubeconfig file.  Specify the manifest YAML you created in step 1 to the "-f" flag.

    $ tanzu mission-control cluster attach -n testcluster -k ~/.kube/config -f /tmp/tmccluster-manifest.yaml