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