Connect to your provisioned cluster with kubectl.

After you have provisioned a cluster in your connected cloud provider account using VMware Tanzu Mission Control, you can connect to the cluster and run commands against it using the Tanzu Mission Control CLI (tmc) and kubectl. Tanzu Mission Control provides a kubeconfig file to enable this connection.

Prerequisites

To complete this procedure, you must first complete the following tasks:
  • Log in to the Tanzu Mission Control console.
  • Provision a cluster, as described in Provision a New Cluster.
  • Install the Kubernetes command-line interface (kubectl).
  • Open a command window.

Before you attempt to connect to a newly provisioned cluster, make sure it is up and running. After the provisioning and creating process is complete, the status is updated to Ready and the type shows that it is a Provisioned cluster in your cloud provider account.

Procedure

  1. Click Clusters in the left navigation pane, and then search or sort (if necessary) to find the cluster you created.
  2. Click the cluster name to go to the cluster detail page.
  3. 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. Download and install the Tanzu Mission Control CLI (tmc) for your platform, and make sure it is executable and accessible in your PATH.
  6. 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.yaml get namespaces
    Note: The path/file value that you pass to the --kubeconfig flag must be an absolute path.
  7. After you have connected kubectl to your cluster, you can click OK to close the dialog.