To use kubectl and tmc (the Tanzu Mission Control CLI) with a provisioned cluster, download the generated configuration file and initialize the connection.

After you have provisioned a new cluster using Tanzu Mission Control, you can connect to it with kubectl using the configuration file that Tanzu Mission Control generates for you.

Prerequisites

This procedure assumes that you have already performed the following tasks:
  • Provision a cluster through VMware Tanzu Mission Control, as described in Provision a Cluster in Your aws-hosted Management Cluster.
  • Install the Kubernetes command-line interface (kubectl).
  • Open a browser window, and log in to the Tanzu Mission Control console.
  • Open a command window, and log in with the Tanzu Mission Control CLI.

Procedure

  1. In the left navigation pane of the Tanzu Mission Control console, click Clusters.
  2. On the Clusters page, click the cluster to which you want to connect.
  3. On the cluster detail page, in the upper right corner, click Access this cluster.
  4. In the resulting popup modal, click Download KUBECONFIG file. and save the downloaded YAML file in a location that is accessible to kubectl (for example, in ~/.kube/config or in a location specified in the KUBECONFIG environment variable).
  5. Run a kubectl command to initialize the configuration. For example, the following command retrieves a list of namespaces in your cluster.
    kubectl get namespaces
    You can optionally use the --kubeconfig flag to specify the location and name of your downloaded kubeconfig YAML file. The command looks something like this:
    kubectl --kubeconfig=/path/to/kubeconfig-my-provisioned-cluster.yml get namespaces
    Note: The path/file value that you pass to the --kubeconfig flag must be an absolute path.
    If you are not logged in with the Tanzu Mission Control CLI, you are prompted to do so.