After adding a cluster to Tanzu Platform management, you can connect to the cluster from kubectl by using the configuration file that Tanzu Platform generates for you.
This procedure assumes that you have a managed cluster and that you have already performed the following tasks:
You can get the kubeconfig file using Tanzu Platform hub.
~/.kube/config
or in a location specified in the KUBECONFIG environment variable.To initialize the configuration:
Run a kubectl
command to initialize the configuration. For example, the following command retrieves a list of namespaces in your cluster.
kubectl get namespaces
(Optional) 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
NoteThe
path/file
value that you pass to the--kubeconfig
flag must be an absolute path.