After you have added a cluster into Tanzu Platform management, you can connect to it with kubectl
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:
kubectl
).tanzu
CLI. For more information, see the VMware Tanzu CLI Documentation.You can get the kubeconfig file using Tanzu Platform hub.
~/.kube/config
or in a location specified in the KUBECONFIG environment variable).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
NoteThe
path/file
value that you pass to the--kubeconfig
flag must be an absolute path.