You can use Tanzu Kubernetes Grid to deploy multiple management clusters from the same bootstrap environment, to both vSphere and Amazon EC2.

You can manage all of the management clusters from the same Tanzu Kubernetes Grid CLI instance, by switching the focus of the CLI between the contexts of the different management clusters. You can also add management clusters that someone else created to your kubeconfig, so that you can manage those clusters from your Tanzu Kubernetes Grid CLI instance.

Prerequisites

You have deployed at least two management clusters, to either vSphere or Amazon EC2, or both.

Procedure

  1. On the bootstrap environment machine on which you ran tkg init, run the tkg get management-cluster command to see the list of management clusters that you have deployed.

    tkg get management-cluster
    

    If you deployed two management clusters, named my-vsphere-cluster and my-aws-cluster, you will see the following output:

    +-------------------------+----------------------------------------------+
    | MANAGEMENT CLUSTER NAME | CONTEXT NAME                                 |
    +-------------------------+----------------------------------------------+
    | my-vsphere-cluster *    | my-vsphere-cluster-admin@my-vsphere-cluster  |
    | my-aws-cluster          | my-aws-cluster-admin@my-aws-cluster          | 
    +-------------------------+----------------------------------------------+
    

    The management cluster context that is the current focus of the Tanzu Kubernetes Grid CLI is marked with an asterisk (*). By default, the management cluster that you deployed most recently is the focus of the Tanzu Kubernetes Grid CLI.

  2. To change the focus of the Tanzu Kubernetes Grid CLI to a different management cluster context, run the tkg set management-cluster command.

    tkg set management-cluster my-aws-cluster 
    
  3. To add a management cluster that someone else created to your list of managed management clusters, use the tkg add management-cluster command.

    1. Obtain the kubeconfig of the management cluster that you want to add, and save it on your bootstrap environment.
    2. Set an environment variable to point to the kubeconfig file of the new management cluster.

      export KUBECONFIG=~/<path>/mgmt-cluster.kubeconfig
      
    3. Set the focus of kubectl to the context of the new management cluster.

      kubectl config use-context mgmt-cluster-admin@mgmt-cluster
      
    4. Add the new cluster to your Tanzu Kubernetes Grid instance.

      tkg add management-cluster 
      
    5. Run tkg get management-cluster to see the newly added cluster in your list of management clusters.
    6. Set the focus of the Tanzu Kubernetes Grid CLI to the new cluster.

      tkg set management-cluster new-cluster
      

What to Do Next

You can use Tanzu Kubernetes Grid to start deploying Tanzu Kubernetes clusters to different Tanzu Kubernetes Grid instances. For information, see Deploying Tanzu Kubernetes Clusters and Managing their Lifecycle.

If you have vSphere 7.0, you can also deploy and manage Tanzu Kubernetes clusters in vSphere with Kubernetes. For information, see Use the Tanzu Kubernetes Grid CLI with a vSphere with Kubernetes Supervisor Cluster .

check-circle-line exclamation-circle-line close-line
Scroll to top icon