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 attached or 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.
Note: Tanzu Mission Control supports kubeconfig access to the following types of attached public cloud clusters:
- Amazon Elastic Kubernetes Service (EKS)
- Azure Kubernetes Service (AKS)
- Google Kubernetes Engine (GKE)
For more information, see Enable Access to Public Cloud Clusters Through Tanzu Mission Control.
This procedure assumes that you have a managed cluster, either attached or provisioned, and that you have already performed the following tasks:
- 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.
- In the left navigation pane of the Tanzu Mission Control console, click Clusters.
- On the Clusters page, click the cluster to which you want to connect.
- On the cluster detail page, in the upper right corner, click Access this cluster.
- In the resulting popup modal, click Download KUBECONFIG file. and then choose the CLI that you want to use (
- 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).
- Run a kubectl command to initialize the configuration. For example, the following command retrieves a list of namespaces in your cluster.
kubectl get namespacesYou can optionally use the
--kubeconfigflag 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 namespacesNote: The path/file value that you pass to the
--kubeconfigflag must be an absolute path.If you are not logged in with the Tanzu Mission Control CLI, you are prompted to provide an API token to log in. For information about retrieving an API token, see Log In with the Tanzu CLI.