Follow these steps to connect to Supervisor using the Tanzu CLI and authenticate as a vCenter Single Sign-On user.
Prerequisites
Complete the following prerequisites.
- Install and configure the Kubernetes CLI Tools for vSphere. See Connecting to TKG Service Clusters Using vCenter SSO Authentication.
- Install and initialize the Tanzu CLI. See Install the Tanzu CLI for Use with TKG Service Clusters.
Connect to Supervisor Using the Tanzu CLI and vCenter SSO
Complete the following steps.
- Connect to Supervisor as a vCenter SSO user.
kubectl vsphere login --server=SUPERVISOR-CONTROL-PLANE-IP-ADDRESS --vsphere-username VCENTER-SSO-USER
This action populates kubeconfig with the Supervisor context that the Tanzu CLI uses.
- Switch context to the vSphere Namespace for Supervisor.
kubectl config get-contexts
kubectl config use-context <SUPERVISOR-CONTROL-PLANE-IP-ADDRESS>
- Log in to Supervisor using the Tanzu CLI and vCenter SSO.
tanzu context create context_name --kubeconfig ~/.kube/config --kubecontext SUPERVISOR-CONTROL-PLANE-IP-ADDRESS
Where:context_name
is the user-defined name for this context, such as "supervisor".--kubeconfig ~/.kube/config
is the path to the localkubeconfig
file, which defaults to~/.kube/config
and is set by theKUBECONFIG
environment variable, and which contains the Supervisor configuration context for your vCenter SSO user.--kubecontext SUPERVISOR-CONTROL-PLANE-IP-ADDRESS
is the context of the Supervisor, which is the same asSUPERVISOR_IP
, such as10.179.144.55
.
- Run Tanzu CLI commands and verify connectivity.
tanzu plugin list
tanzu cluster list -n VSPHERE-NS-FOR-TKG